mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Use a temporary copy of our tar binary during OTA updating, to avoid the
potential for a SIGBUS error... Fix #4602
This commit is contained in:
@@ -107,9 +107,14 @@ ko_update_check() {
|
||||
FILESIZE="$(stat -c %b "${NEWUPDATE}")"
|
||||
BLOCKS="$((FILESIZE / 20))"
|
||||
export CPOINTS="$((BLOCKS / 100))"
|
||||
# NOTE: To avoid blowing up when tar truncates itself during an update, copy our GNU tar binary to the system's tmpfs,
|
||||
# and run that one (c.f., #4602)...
|
||||
cp -pf ./tar /var/tmp/gnutar
|
||||
# shellcheck disable=SC2016
|
||||
./tar --no-same-permissions --no-same-owner --checkpoint="${CPOINTS}" --checkpoint-action=exec='./fbink -q -y -6 -P $(($TAR_CHECKPOINT/$CPOINTS))' -C "/mnt/us" -xf "${NEWUPDATE}"
|
||||
/var/tmp/gnutar --no-same-permissions --no-same-owner --checkpoint="${CPOINTS}" --checkpoint-action=exec='./fbink -q -y -6 -P $(($TAR_CHECKPOINT/$CPOINTS))' -C "/mnt/us" -xf "${NEWUPDATE}"
|
||||
fail=$?
|
||||
# And remove our temporary tar binary...
|
||||
rm -f /var/tmp/gnutar
|
||||
# Cleanup behind us...
|
||||
if [ "${fail}" -eq 0 ]; then
|
||||
mv "${NEWUPDATE}" "${INSTALLED}"
|
||||
|
||||
Reference in New Issue
Block a user