Skip to content

Commit 263ea26

Browse files
authored
Mysgw configure: Exit on illegal parameters (#1519)
The user probably made a mistake. Let the user correct the mistake before continuing. Ref: #1518 Example output after this change: $ ./configure --my-transport=laser [SECTION] Detecting target machine. [OK] machine detected: SoC=unknown, Type=unknown, CPU=x86_64. [SECTION] Checking GPIO Sysfs. [WARNING] /sys/class/gpio/export not found. [SECTION] Detecting SPI driver. [WARNING] No supported SPI driver detected. Using SPIDEV. [SECTION] Gateway configuration. [OK] Type: ethernet. [ERROR] Invalid transport type laser. $ ./configure --my-mqtt-username=user [ERROR] Unknown option detected: --my-mqtt-username=user
1 parent d62ca6d commit 263ea26

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

configure

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ FAILED="${YELLOW}[FAILED]${NO_COLOR}"
134134
SECTION="${LIGHT_BLUE}[SECTION]${NO_COLOR}"
135135

136136
function die {
137-
printf "${ERROR} $1 \n"
137+
printf "${RED}${ERROR} $1${NO_COLOR}\n"
138138
exit $2
139139
}
140140

@@ -451,7 +451,7 @@ for opt do
451451
elif [[ ${optarg} == "915" ]]; then
452452
CPPFLAGS="-DMY_RFM69_FREQUENCY=RFM69_915MHZ $CPPFLAGS"
453453
else
454-
echo "[WARNING] Illegal value for --my-rfm69-frequency=${optarg}, ignored"
454+
die "Illegal value for --my-rfm69-frequency=${optarg}" 8
455455
fi
456456
;;
457457
--my-is-rfm69hw*)
@@ -479,7 +479,7 @@ for opt do
479479
elif [[ ${optarg} == "915" ]]; then
480480
CPPFLAGS="-DMY_RFM95_FREQUENCY=RFM95_915MHZ $CPPFLAGS"
481481
else
482-
echo "[WARNING] Illegal value for --my-rfm95-frequency=${optarg}, ignored"
482+
die "Illegal value for --my-rfm95-frequency=${optarg}" 9
483483
fi
484484
;;
485485
--my-rfm95-irq-pin=*)
@@ -538,7 +538,7 @@ for opt do
538538
security_password=${optarg}
539539
;;
540540
*)
541-
echo "[WARNING] Unknown option detected:$opt, ignored"
541+
die "Unknown option detected: $opt" 10
542542
;;
543543
esac
544544
done
@@ -638,7 +638,7 @@ elif [[ ${transport_type} == "rfm95" ]]; then
638638
elif [[ ${transport_type} == "rs485" ]]; then
639639
CPPFLAGS="-DMY_RS485 $CPPFLAGS"
640640
else
641-
die "Invalid transport type." 3
641+
die "Invalid transport type ${transport_type}." 3
642642
fi
643643
printf " ${OK} Transport: ${transport_type}.\n"
644644

0 commit comments

Comments
 (0)