From b0336e998292884e21c5c432b109202d03269410 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Sat, 24 Apr 2021 19:02:48 +0200 Subject: [PATCH] PocketBook: Workaround platform shenanigans when aplying an OTA (#7585) We can't avoid hitting a few permission errors, so, just filter them out. Fix #7581 --- platform/kobo/koreader.sh | 4 ++-- platform/pocketbook/koreader.app | 19 ++++++++++++++----- platform/remarkable/koreader.sh | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/platform/kobo/koreader.sh b/platform/kobo/koreader.sh index 2d3dd4bfd..0ca1913d2 100755 --- a/platform/kobo/koreader.sh +++ b/platform/kobo/koreader.sh @@ -364,7 +364,7 @@ while [ ${RETURN_VALUE} -ne 0 ]; do ./fbink -q -b -O -m -y 2 "Tap the screen to continue." fi # U+1F4A3, the hard way, because we can't use \u or \U escape sequences... - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3003 ./fbink -q -b -O -m -t regular=./fonts/freefont/FreeSerif.ttf,px=${bombHeight},top=${bombMargin} -- $'\xf0\x9f\x92\xa3' # And then print the tail end of the log on the bottom of the screen... crashLog="$(tail -n 25 crash.log | sed -e 's/\t/ /g')" @@ -388,7 +388,7 @@ while [ ${RETURN_VALUE} -ne 0 ]; do if [ ${CRASH_COUNT} -eq 1 ]; then # NOTE: We don't actually care about what read read, we're just using it as a fancy sleep ;). # i.e., we pause either until the 15s timeout, or until the user touches the screen. - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3045 read -r -t 15 "${KO_PB_TARLOG}" fail=$? + # As mentioned above, filter out potential chmod & utime failures... + if [ "${fail}" -ne 0 ]; then + if [ "$(grep -Evc '(Cannot utime|Cannot change mode|Exiting with failure status due to previous errors)' "${KO_PB_TARLOG}")" -eq "0" ]; then + # No other errors, we're good! + fail=0 + fi + fi + rm -f "${KO_PB_TARLOG}" # Cleanup behind us... if [ "${fail}" -eq 0 ]; then mv "${NEWUPDATE}" "${INSTALLED}" @@ -44,12 +55,10 @@ ko_update_check() { "${KOREADER_DIR}/fbink" -q -y -6 -pmh "Update failed :(" "${KOREADER_DIR}/fbink" -q -y -5 -pm "KOReader may fail to function properly!" fi - rm -f "${NEWUPDATE}" # always purge newupdate in all cases to prevent update loop + rm -f "${NEWUPDATE}" # always purge newupdate to prevent update loops unset BLOCKS CPOINTS # Ensure everything is flushed to disk before we restart. This *will* stall for a while on slow storage! sync - # Don't forget to go back home, for proper restart behavior - cd ${KOREADER_DIR} || exit fi } @@ -133,7 +142,7 @@ while [ "${RETURN_VALUE}" -ne 0 ]; do "${KOREADER_DIR}/fbink" -q -b -O -m -y 2 "KOReader will restart in 15 sec." fi # U+1F4A3, the hard way, because we can't use \u or \U escape sequences... - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3003 "${KOREADER_DIR}/fbink" -q -b -O -m -t regular=${KOREADER_DIR}/fonts/freefont/FreeSerif.ttf,px=${bombHeight},top=${bombMargin} -- $'\xf0\x9f\x92\xa3' # And then print the tail end of the log on the bottom of the screen... crashLog="$(tail -n 25 crash.log | sed -e 's/\t/ /g')" diff --git a/platform/remarkable/koreader.sh b/platform/remarkable/koreader.sh index b75864181..f0b8975c1 100755 --- a/platform/remarkable/koreader.sh +++ b/platform/remarkable/koreader.sh @@ -181,7 +181,7 @@ while [ ${RETURN_VALUE} -ne 0 ]; do ./fbink -q -b -O -m -y 2 "KOReader will restart in 15 sec." fi # U+1F4A3, the hard way, because we can't use \u or \U escape sequences... - # shellcheck disable=SC2039 + # shellcheck disable=SC2039,SC3003 ./fbink -q -b -O -m -t regular=./fonts/freefont/FreeSerif.ttf,px=${bombHeight},top=${bombMargin} -- $'\xf0\x9f\x92\xa3' # And then print the tail end of the log on the bottom of the screen... crashLog="$(tail -n 25 crash.log | sed -e 's/\t/ /g')"