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
reviewable/pr7595/r1
NiLuJe 3 years ago committed by GitHub
parent 5ed272a786
commit b0336e9982
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 </dev/input/event1
fi
# Cycle the last crash timestamp

@ -31,9 +31,20 @@ ko_update_check() {
FILESIZE="$(stat -c %b "${NEWUPDATE}")"
BLOCKS="$((FILESIZE / 20))"
export CPOINTS="$((BLOCKS / 100))"
# NOTE: We don't run as root, but folders created over USBMS are owned by root, which yields fun permission shenanigans...
# c.f., https://github.com/koreader/koreader/issues/7581
KO_PB_TARLOG="/tmp/.koreader.tar"
# shellcheck disable=SC2016
cd /mnt/ext1 && "${KOREADER_DIR}/tar" xf "${NEWUPDATE}" --no-same-permissions --no-same-owner --checkpoint="${CPOINTS}" --checkpoint-action=exec='${KOREADER_DIR}/fbink -q -y -6 -P $(($TAR_CHECKPOINT/$CPOINTS))'
"${KOREADER_DIR}/tar" --no-same-permissions --no-same-owner --checkpoint="${CPOINTS}" --checkpoint-action=exec='${KOREADER_DIR}/fbink -q -y -6 -P $(($TAR_CHECKPOINT/$CPOINTS))' -C "/mnt/ext1" -xf "${NEWUPDATE}" 2>"${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')"

@ -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')"

Loading…
Cancel
Save