kobo: minor cleanups

This commit is contained in:
Benoit Pierre
2025-12-13 00:35:49 +01:00
committed by Frans de Jonge
parent 3644299a66
commit e04f1800ba
2 changed files with 5 additions and 6 deletions

View File

@@ -1610,12 +1610,9 @@ function Kobo:defaultCPUGovernor()
end
function Kobo:isStartupScriptUpToDate()
-- Compare the hash of the *active* script (i.e., the one in /tmp) to the *potential* one (i.e., the one in KOREADER_DIR)
local current_script = "/tmp/koreader.sh"
local new_script = os.getenv("KOREADER_DIR") .. "/" .. "koreader.sh"
local md5 = require("ffi/MD5")
return md5.sumFile(current_script) == md5.sumFile(new_script)
-- Compare the hash of the *active* script to the *potential* one.
return md5.sumFile("/tmp/koreader.sh") == md5.sumFile(os.getenv("KOREADER_DIR") .. "/koreader.sh")
end
function Kobo:UIManagerReady(uimgr)

View File

@@ -10,7 +10,9 @@ UNPACK_DIR="${KOREADER_DIR%/*}"
# We rely on starting from our working directory, and it needs to be set, sane and absolute.
cd "${KOREADER_DIR:-/dev/null}" || exit
# To make USBMS behave, relocalize ourselves outside of onboard
# To make USBMS behave, relocalize ourselves outside of onboard. Additionally,
# 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 [ "${SCRIPT_DIR}" != "/tmp" ]; then
cp -pf "${0}" "/tmp/koreader.sh"
chmod 777 "/tmp/koreader.sh"