kindle / pocketbook / remarkable: fix startup script change detection
- prior to #14719, `$KOREADER_DIR` was not part of the environment, so an update relying on it without a restart from the parent launcher would crash KOReader on startup - pocketbook: fix check (`koreader.app` is located in `$KOREADER_DIR/..`) - remarkable: ensure `$KOREADER_DIR` remain correct after relocalization
This commit is contained in:
1 parent
f731870427
commit
8d7b0792fb
7 files changed
+23
-21
No files matched your search
@@ -801,7 +801,7 @@ 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")
|
||||
return md5.sumFile("/var/tmp/koreader.sh") == md5.sumFile("koreader.sh")
|
||||
end
|
||||
|
||||
function Kindle:UIManagerReady(uimgr)
|
||||
|
||||
@@ -416,7 +416,7 @@ 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")
|
||||
return md5.sumFile("/tmp/koreader.app") == md5.sumFile("../koreader.app")
|
||||
end
|
||||
|
||||
function PocketBook:UIManagerReady(uimgr)
|
||||
|
||||
@@ -429,7 +429,7 @@ 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")
|
||||
return md5.sumFile("/tmp/koreader.sh") == md5.sumFile("koreader.sh")
|
||||
end
|
||||
|
||||
function Remarkable:setEventHandlers(UIManager)
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
UNPACK_DIR='/mnt/us'
|
||||
# KOReader's working directory.
|
||||
KOREADER_DIR="${UNPACK_DIR}/koreader"
|
||||
|
||||
# NOTE: Stupid workaround to make sure the script we end up running is a *copy*,
|
||||
# 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,
|
||||
@@ -13,17 +19,11 @@ if [ "$(dirname "${0}")" != "/var/tmp" ]; then
|
||||
exec /var/tmp/koreader.sh "$@"
|
||||
fi
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
PROC_KEYPAD="/proc/keypad"
|
||||
PROC_FIVEWAY="/proc/fiveway"
|
||||
[ -e "${PROC_KEYPAD}" ] && echo unlock >"${PROC_KEYPAD}"
|
||||
[ -e "${PROC_FIVEWAY}" ] && echo unlock >"${PROC_FIVEWAY}"
|
||||
|
||||
UNPACK_DIR='/mnt/us'
|
||||
# KOReader's working directory
|
||||
export KOREADER_DIR="${UNPACK_DIR}/koreader"
|
||||
|
||||
# NOTE: Same vfat+fuse shenanigans needed for FBInk, before we source libko...
|
||||
cp -pf "${KOREADER_DIR}/fbink" /var/tmp/fbink
|
||||
chmod 777 /var/tmp/fbink
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# Compute our working directory in an extremely defensive manner
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
UNPACK_DIR='/mnt/ext1'
|
||||
# KOReader's working directory.
|
||||
KOREADER_DIR="${UNPACK_DIR}/applications/koreader"
|
||||
|
||||
# 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).
|
||||
@@ -9,12 +15,6 @@ if [ "$(dirname "${0}")" != '/tmp' ]; then
|
||||
exec '/tmp/koreader.app' "$@"
|
||||
fi
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
UNPACK_DIR='/mnt/ext1'
|
||||
# working directory of 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).
|
||||
export LD_LIBRARY_PATH="${KOREADER_DIR}/libs${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# 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).
|
||||
@@ -9,12 +16,6 @@ if [ "$(dirname "${0}")" != '/tmp' ]; then
|
||||
exec '/tmp/koreader.sh' "$@"
|
||||
fi
|
||||
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# working directory of koreader
|
||||
export KOREADER_DIR="${0%/*}"
|
||||
UNPACK_DIR="${KOREADER_DIR%/*}"
|
||||
|
||||
# we're always starting from our working directory
|
||||
cd "${KOREADER_DIR}" || exit
|
||||
|
||||
|
||||
Reference in new issue
Block a user