2012-10-02 22:45:45 +00:00
|
|
|
#!/bin/sh
|
|
|
|
export LC_ALL="en_US.UTF-8"
|
|
|
|
|
2012-12-12 02:02:32 +00:00
|
|
|
PROC_KEYPAD="/proc/keypad"
|
|
|
|
PROC_FIVEWAY="/proc/fiveway"
|
|
|
|
test -e $PROC_KEYPAD && echo unlock > $PROC_KEYPAD
|
|
|
|
test -e $PROC_FIVEWAY && echo unlock > $PROC_FIVEWAY
|
2012-10-02 22:45:45 +00:00
|
|
|
|
|
|
|
# we're always starting from our working directory
|
2013-03-24 16:22:22 +00:00
|
|
|
cd /mnt/us/koreader/
|
2012-10-02 22:45:45 +00:00
|
|
|
|
2013-04-23 22:59:52 +00:00
|
|
|
# export trained OCR data directory
|
|
|
|
export TESSDATA_PREFIX="data"
|
|
|
|
|
2013-04-30 10:47:30 +00:00
|
|
|
# export dict directory
|
|
|
|
export STARDICT_DATA_DIR="data/dict"
|
|
|
|
|
2012-10-02 22:45:45 +00:00
|
|
|
# bind-mount system fonts
|
2013-03-24 16:22:22 +00:00
|
|
|
if ! grep /mnt/us/koreader/fonts/host /proc/mounts; then
|
|
|
|
mount -o bind /usr/java/lib/fonts /mnt/us/koreader/fonts/host
|
2012-10-02 22:45:45 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# check if we are supposed to shut down the Amazon framework
|
|
|
|
if test "$1" == "--framework_stop"; then
|
|
|
|
shift 1
|
|
|
|
/etc/init.d/framework stop
|
|
|
|
fi
|
|
|
|
|
2013-06-13 08:42:19 +00:00
|
|
|
# check if kpvbooklet was launched for more than once, if not we will disable pillow
|
|
|
|
count=`lipc-get-prop -eiq com.github.koreader.kpvbooklet.timer count`
|
|
|
|
if [ "$count" == "" -o "$count" == "0" ]; then
|
|
|
|
lipc-set-prop com.lab126.pillow disableEnablePillow disable
|
|
|
|
fi
|
2013-03-12 14:14:17 +00:00
|
|
|
|
2012-10-02 22:45:45 +00:00
|
|
|
# stop cvm
|
2013-01-10 06:23:11 +00:00
|
|
|
#killall -stop cvm
|
2012-10-02 22:45:45 +00:00
|
|
|
|
|
|
|
# finally call reader
|
2012-11-05 11:39:58 +00:00
|
|
|
./reader.lua "$1" 2> crash.log
|
2012-10-02 22:45:45 +00:00
|
|
|
|
2013-07-12 03:11:28 +00:00
|
|
|
# clean up forked process in case the reader crashed
|
|
|
|
killall reader.lua
|
|
|
|
|
2012-10-02 22:45:45 +00:00
|
|
|
# unmount system fonts
|
2013-03-24 16:22:22 +00:00
|
|
|
if grep /mnt/us/koreader/fonts/host /proc/mounts; then
|
|
|
|
umount /mnt/us/koreader/fonts/host
|
2012-10-02 22:45:45 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# always try to continue cvm
|
|
|
|
killall -cont cvm || /etc/init.d/framework start
|
2013-03-12 14:14:17 +00:00
|
|
|
|
|
|
|
# display chrome bar
|
|
|
|
lipc-set-prop com.lab126.pillow disableEnablePillow enable
|
|
|
|
|