mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
remarkable: detect if launcher script has changed
And a complete restart from the parent launcher is needed.
This commit is contained in:
committed by
Frans de Jonge
parent
0094ea2cb0
commit
2e2a4875c9
@@ -426,6 +426,12 @@ function Remarkable:getDefaultCoverPath()
|
|||||||
return "/usr/share/remarkable/poweroff.png"
|
return "/usr/share/remarkable/poweroff.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Remarkable:isStartupScriptUpToDate()
|
||||||
|
local md5 = require("ffi/MD5")
|
||||||
|
-- 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 Remarkable:setEventHandlers(UIManager)
|
function Remarkable:setEventHandlers(UIManager)
|
||||||
UIManager.event_handlers.Suspend = function()
|
UIManager.event_handlers.Suspend = function()
|
||||||
self:onPowerEvent("Suspend")
|
self:onPowerEvent("Suspend")
|
||||||
|
|||||||
@@ -1,7 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/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.sh'
|
||||||
|
chmod 777 '/tmp/koreader.sh'
|
||||||
|
exec '/tmp/koreader.sh' "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
export LC_ALL="en_US.UTF-8"
|
export LC_ALL="en_US.UTF-8"
|
||||||
|
|
||||||
# working directory of koreader
|
# working directory of koreader
|
||||||
KOREADER_DIR="${0%/*}"
|
export KOREADER_DIR="${0%/*}"
|
||||||
UNPACK_DIR="${KOREADER_DIR%/*}"
|
UNPACK_DIR="${KOREADER_DIR%/*}"
|
||||||
|
|
||||||
# we're always starting from our working directory
|
# we're always starting from our working directory
|
||||||
|
|||||||
Reference in New Issue
Block a user