kindle: detect if launcher script has changed

And a complete restart from the parent launcher (e.g. KUAL) is needed.
This commit is contained in:
Benoit Pierre
2025-12-13 00:35:50 +01:00
committed by Frans de Jonge
parent e04f1800ba
commit c93624d2c5
2 changed files with 9 additions and 0 deletions

View File

@@ -782,6 +782,12 @@ function Kindle:readyToSuspend(delay)
self.suspend_time = time.boottime_or_realtime_coarse()
end
function Kindle:isStartupScriptUpToDate()
local md5 = require("ffi/MD5")
-- Compare the hash of the *active* script to the *potential* one.
return md5.sumFile("/var/tmp/koreader.sh") == md5.sumFile(os.getenv("KOREADER_DIR") .. "/koreader.sh")
end
function Kindle:UIManagerReady(uimgr)
UIManager = uimgr
end

View File

@@ -4,6 +4,9 @@
# living in a magical land that doesn't suffer from gross filesystem deficiencies.
# Otherwise, the vfat+fuse mess means an OTA update will break the script on exit,
# and potentially leave the user in a broken state, with the WM still paused...
# 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 [ "$(dirname "${0}")" != "/var/tmp" ]; then
cp -pf "${0}" /var/tmp/koreader.sh
chmod 777 /var/tmp/koreader.sh