Detect early KoboUSBMS returns, and just restart KOReader (#6603)

We know onboard is safe in these cases.
reviewable/pr6609/r1
NiLuJe 4 years ago committed by GitHub
parent 6d3d45a93b
commit 12df296b90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -380,12 +380,19 @@ while [ ${RETURN_VALUE} -ne 0 ]; do
echo "Couldn't chdir to /tmp/usbms, restarting KOReader . . ." >>crash.log 2>&1 echo "Couldn't chdir to /tmp/usbms, restarting KOReader . . ." >>crash.log 2>&1
continue continue
fi fi
if ! env LANGUAGE="${usbms_lang}" ./usbms; then env LANGUAGE="${usbms_lang}" ./usbms
# Hu, oh, something went wrong... Stay around for 90s (enough time to look at the syslog over Wi-Fi), and then shutdown. fail=$?
fail=$? if [ ${fail} -ne 0 ]; then
logger -p "DAEMON.CRIT" -t "koreader.sh[$$]" "USBMS session failed (${fail}), shutting down in 90 sec!" # NOTE: Early init failures return KO_RC_USBMS,
sleep 90 # to allow simply restarting KOReader when we know the integrity of onboard hasn't been compromised...
poweroff -f if [ ${fail} -eq ${KO_RC_USBMS} ]; then
echo "KoboUSBMS failed to setup an USBMS session, restarting KOReader . . ." >>"${KOREADER_DIR}/crash.log" 2>&1
else
# Hu, oh, something went wrong... Stay around for 90s (enough time to look at the syslog over Wi-Fi), and then shutdown.
logger -p "DAEMON.CRIT" -t "koreader.sh[$$]" "USBMS session failed (${fail}), shutting down in 90 sec!"
sleep 90
poweroff -f
fi
fi fi
# Jump back to the right place, and keep on trucking # Jump back to the right place, and keep on trucking

Loading…
Cancel
Save