ublox-gsm-fw-update: Fix blocking timeout when using RPM

When running the script through RPM installer, the cat process
does not stop when receiving the TERM signal. So the KILL signal
has to be used to make sure that the script is not blocking.

BugzID: 60344
This commit is contained in:
Alexandre Bard 2019-12-19 14:47:43 +01:00
parent 3ca58174f3
commit 28d7752efa
1 changed files with 7 additions and 4 deletions

View File

@ -34,13 +34,14 @@ if [ $? -eq 0 ]; then
systemctl stop ModemManager systemctl stop ModemManager
fi fi
# Empty data in serial device echo Empty data in serial device
printf '\r\n' > $TTY_DEVICE printf '\r\n' > $TTY_DEVICE
timeout 5 cat $TTY_DEVICE > /dev/null timeout -k 5 5 cat $TTY_DEVICE > /dev/null
timeout -k 5 5 cat $TTY_DEVICE > /dev/null
# Check running version echo Check running version
printf '\r\nAT+CGMR\r\n' > $TTY_DEVICE printf '\r\nAT+CGMR\r\n' > $TTY_DEVICE
timeout 5 cat $TTY_DEVICE | grep -B3 -m 1 "OK" | grep "$FW_VERSION" timeout -k 5 5 cat $TTY_DEVICE | grep -B3 -m 1 "OK" | grep "$FW_VERSION"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "The modem is already running the same FW version" echo "The modem is already running the same FW version"
@ -53,6 +54,8 @@ else
systemctl restart ublox-gsm-config systemctl restart ublox-gsm-config
fi fi
rm -rf $TMP_PATH
if [ "$MM_RUNNING" = "1" ]; then if [ "$MM_RUNNING" = "1" ]; then
echo "Restarting ModemManager" echo "Restarting ModemManager"
systemctl start ModemManager systemctl start ModemManager