From bf0f8d66f06623142e4cb8c44822c75ebcac6af3 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 7 Nov 2022 17:14:40 +0100 Subject: [PATCH] Kobo: Don't exit the startup script on shutdown when started via KSM. This ensures we keep displaying our own stuff, without KSM interference. Fix #9748 --- platform/kobo/koreader.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/platform/kobo/koreader.sh b/platform/kobo/koreader.sh index 0cb56b9a4..31ff1b9b2 100755 --- a/platform/kobo/koreader.sh +++ b/platform/kobo/koreader.sh @@ -611,10 +611,20 @@ if [ ${RETURN_VALUE} -ne ${KO_RC_HALT} ]; then # if we were called from advboot then we must reboot to go to the menu # NOTE: This is actually achieved by checking if KSM or a KSM-related script is running: # This might lead to false-positives if you use neither KSM nor advboot to launch KOReader *without nickel running*. - if ! pgrep -f kbmenu >/dev/null 2>&1; then + if ! pkill -0 kbmenu; then /sbin/reboot fi fi +else + if [ "${VIA_NICKEL}" = "false" ]; then + if pkill -0 kbmenu; then + # If we were started by KSM and requested an exit, attempt to *NOT* exit the script, + # so as not to re-enter KSM at all, to make sure the device powers off with our own ScreenSaver displayed. + # NOTE: This might not be fool-proof, as a poweroff might take longer than that, + # or we might be interrupted early by signals. + sleep 10 + fi + fi fi # Wipe the clones on exit