pocketbook: detect if launcher script has changed

And a complete restart from the parent launcher is needed.
This commit is contained in:
Benoit Pierre
2025-12-13 00:35:51 +01:00
committed by Frans de Jonge
parent c93624d2c5
commit 0094ea2cb0
2 changed files with 17 additions and 1 deletions

View File

@@ -413,6 +413,12 @@ function PocketBook:getDefaultCoverPath()
return "/mnt/ext1/system/logo/offlogo/cover.bmp"
end
function PocketBook:isStartupScriptUpToDate()
local md5 = require("ffi/MD5")
-- Compare the hash of the *active* script to the *potential* one.
return md5.sumFile("/tmp/koreader.app") == md5.sumFile(os.getenv("KOREADER_DIR") .. "/koreader.app")
end
function PocketBook:UIManagerReady(uimgr)
UIManager = uimgr
end

View File

@@ -1,9 +1,19 @@
#!/bin/sh
# Relocalize ourselves to /tmp: this is used by KOReader to detect if the
# original script has changed after an update (requiring a complete restart
# from the parent launcher).
if [ "$(dirname "${0}")" != '/tmp' ]; then
cp -pf "${0}" '/tmp/koreader.app'
chmod 777 '/tmp/koreader.app'
exec '/tmp/koreader.app' "$@"
fi
export LC_ALL="en_US.UTF-8"
UNPACK_DIR='/mnt/ext1'
# working directory of koreader
KOREADER_DIR="${UNPACK_DIR}/applications/koreader"
export KOREADER_DIR="${UNPACK_DIR}/applications/koreader"
# load our own shared libraries if possible, solely because we don't control InkView, and we'd rather not it have load duplicate system libs...
# (We handle this via DT_RPATH for our own stuff).