cervantes: detect if launcher script has changed
And a complete restart from the parent launcher is needed.
This commit is contained in:
1 parent
8d7b0792fb
commit
0b53cefb9f
2 files changed
+18
-2
No files matched your search
@@ -196,6 +196,12 @@ function Cervantes:powerOff()
|
||||
os.execute("sleep 1 && halt &")
|
||||
end
|
||||
|
||||
function Cervantes: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("koreader.sh")
|
||||
end
|
||||
|
||||
-- This method is the same as the one in kobo/device.lua except the sleep cover part.
|
||||
function Cervantes:setEventHandlers(UIManager)
|
||||
-- We do not want auto suspend procedure to waste battery during
|
||||
|
||||
@@ -2,10 +2,20 @@
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# working directory of koreader
|
||||
KOREADER_DIR="${0%/*}"
|
||||
# KOReader's working directory.
|
||||
# NOTE: We need to remember the *actual* KOREADER_DIR, not the relocalized version in /tmp...
|
||||
export KOREADER_DIR="${KOREADER_DIR:-${0%/*}}"
|
||||
UNPACK_DIR="${KOREADER_DIR%/*}"
|
||||
|
||||
# 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
|
||||
|
||||
# we're always starting from our working directory
|
||||
cd "${KOREADER_DIR}" || exit
|
||||
|
||||
|
||||
Reference in new issue
Block a user