Update KoboUSBMS for CJK support (#6639)

* Making the startup script even more tortuous in the process...

* Bump base

https://github.com/koreader/koreader-base/pull/1179
https://github.com/koreader/koreader-base/pull/1180
reviewable/pr6640/r1
NiLuJe 4 years ago committed by GitHub
parent 16ece06d45
commit 051c8c0d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 0dc71fd1b43cf41d116404ad59ab2c5c9fa50898
Subproject commit 8efd649950d296fc79d8ce5ef50060ef815f6f5a

@ -362,9 +362,22 @@ while [ ${RETURN_VALUE} -ne 0 ]; do
if [ ${RETURN_VALUE} -eq ${KO_RC_USBMS} ]; then
# User requested an USBMS session, setup the tool outside of onboard
mkdir -p "/tmp/usbms"
if ! ./tar xzf "./data/KoboUSBMS.tar.gz" -C "/tmp/usbms"; then
echo "Couldn't unpack KoboUSBMS to /tmp/usbms, restarting KOReader . . ." >>crash.log 2>&1
USBMS_HOME="/mnt/usbms"
mkdir -p "${USBMS_HOME}"
# We're using a custom tmpfs in case /tmp is too small (mainly because we may need to import a large CJK font in there...)
if ! mount -t tmpfs tmpfs ${USBMS_HOME} -o defaults,size=32M,mode=1777,noatime; then
echo "Failed to create the USBMS tmpfs, restarting KOReader . . ." >>crash.log 2>&1
continue
fi
if ! ./tar xzf "./data/KoboUSBMS.tar.gz" -C "${USBMS_HOME}"; then
echo "Couldn't unpack KoboUSBMS, restarting KOReader . . ." >>crash.log 2>&1
if ! umount "${USBMS_HOME}"; then
echo "Couldn't unmount the USBMS tmpfs, shutting down in 30 sec!" >>crash.log 2>&1
sleep 30
poweroff -f
fi
rm -rf "${USBMS_HOME}"
continue
fi
@ -375,9 +388,22 @@ while [ ${RETURN_VALUE} -ne 0 ]; do
usbms_lang="C"
fi
# If the language is CJK, copy the CJK font, too...
case "${usbms_lang}" in
ja* | ko* | zh*)
cp -pf "${KOREADER_DIR}/fonts/noto/NotoSansCJKsc-Regular.otf" "${USBMS_HOME}/resources/fonts/NotoSansCJKsc-Regular.otf"
;;
esac
# Here we go!
if ! cd "/tmp/usbms"; then
echo "Couldn't chdir to /tmp/usbms, restarting KOReader . . ." >>crash.log 2>&1
if ! cd "${USBMS_HOME}"; then
echo "Couldn't chdir to ${USBMS_HOME}, restarting KOReader . . ." >>crash.log 2>&1
if ! umount "${USBMS_HOME}"; then
echo "Couldn't unmount the USBMS tmpfs, shutting down in 30 sec!" >>crash.log 2>&1
sleep 30
poweroff -f
fi
rm -rf "${USBMS_HOME}"
continue
fi
env LANGUAGE="${usbms_lang}" ./usbms
@ -401,7 +427,14 @@ while [ ${RETURN_VALUE} -ne 0 ]; do
sleep 30
poweroff -f
fi
rm -rf "/tmp/usbms"
# Tear down the tmpfs...
if ! umount "${USBMS_HOME}"; then
logger -p "DAEMON.CRIT" -t "koreader.sh[$$]" "Couldn't unmount the USBMS tmpfs, shutting down in 30 sec!"
sleep 30
poweroff -f
fi
rm -rf "${USBMS_HOME}"
fi
done

Loading…
Cancel
Save