From b69882fa3447b7d7ff6d606f093da67f94ffd03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Fdez?= Date: Sat, 10 Nov 2018 13:25:48 +0100 Subject: [PATCH] add safemode tool support https://github.com/pazos/cervantes-safemode ref: https://www.mobileread.com/forums/showpost.php?p=3760905&postcount=2 - kodeps.tar.gz --- platform/cervantes/koreader-standalone.sh | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/platform/cervantes/koreader-standalone.sh b/platform/cervantes/koreader-standalone.sh index bca4a862a..6eda0bb6b 100755 --- a/platform/cervantes/koreader-standalone.sh +++ b/platform/cervantes/koreader-standalone.sh @@ -41,19 +41,34 @@ if [ "$PCB_ID" -eq 68 ] && lsmod | grep -q 8189fs; then modprobe -r 8189fs fi -# start usbnet using BQ scripts (192.168.4.1/24 w/ hardcoded MAC addr) -/usr/bin/usbup.sh -/usr/sbin/inetd +# use 'safemode' tool whenever possible instead of enabling usbnet unconditionally. +if [ -x /usr/bin/safemode ]; then + safemode network +else + # start usbnet using BQ scripts + /usr/bin/usbup.sh + /usr/sbin/inetd +fi # check if KOReader script exists. if [ -x /mnt/private/koreader/koreader.sh ]; then # yada! KOReader is installed and ready to run. while true; do /mnt/private/koreader/koreader.sh - sleep 1 + if [ -x /usr/bin/safemode ]; then + safemode storage || sleep 1 + else + sleep 1 + fi done else - # nothing to do, leaving rc.local. + # KOReader script not found or not executable. + # if 'safemode' was found enable usbnet now, since it is currently disabled + if [ -x /usr/bin/safemode ]; then + /usr/bin/usbup.sh + /usr/sbin/inetd + fi + exit 1 fi