gnss-config: added return code if gpsd restart fails
Script returns 7 if gpsd restart failed. Used for lava testing. BugzID: 62045 Signed-off-by: Tobias Jäggi <tobias.jaeggi@netmodule.com>
This commit is contained in:
parent
fa5d8c2231
commit
90c8eef146
|
|
@ -13,6 +13,7 @@
|
|||
# 4 saving to flash failed
|
||||
# 5 baud rate specified in $CONFIG_FILE not supported by $DEVICE_NAME
|
||||
# 6 set tty baud rate was not successful
|
||||
# 7 failed to restart gpsd
|
||||
|
||||
# static variables
|
||||
DEVICE_NAME="NEO-M8L"
|
||||
|
|
@ -164,6 +165,15 @@ write_config_out(){
|
|||
echo "Supported Augmentation Services: $augment_service" >> $CONFIG_OUT_FILE
|
||||
}
|
||||
|
||||
restart_gpsd(){
|
||||
if [ "$RESTART_GPSD" -eq "1" ]; then
|
||||
systemctl start gpsd
|
||||
if [ "$?" -ne "0" ]; then
|
||||
exit 7 # failed to restart gpsd
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# start of main
|
||||
|
||||
# check if script was launched by systemd
|
||||
|
|
@ -239,9 +249,7 @@ if br_receiver="$(poll_baud_rate_receiver "$DESIRED_BAUD_RATE")";then
|
|||
exit 6
|
||||
fi
|
||||
write_config_out
|
||||
if [ "$RESTART_GPSD" -eq "1" ]; then
|
||||
systemctl start gpsd
|
||||
fi
|
||||
restart_gpsd
|
||||
# script can exit
|
||||
exit 0 # baud rate of receiver is already matching $DESIRED_BAUD_RATE
|
||||
else
|
||||
|
|
@ -330,10 +338,6 @@ else
|
|||
fi
|
||||
|
||||
write_config_out
|
||||
|
||||
# TODO: verify or error handling
|
||||
if [ "$RESTART_GPSD" -eq "1" ]; then
|
||||
systemctl start gpsd
|
||||
fi
|
||||
restart_gpsd
|
||||
|
||||
exit 0 # successfully changed baud rate to $DESIRED_BAUD_RATE specified in $CONFIG_FILE
|
||||
|
|
|
|||
Loading…
Reference in New Issue