From d04e8dcc1f2ca6ad286a734dbb57b19521e0bbae Mon Sep 17 00:00:00 2001 From: Bastien Dejean Date: Mon, 28 Nov 2022 10:25:24 +0100 Subject: [PATCH] Remove support for starting Plato from rcS Recent firmwares made this harder to achieve. --- .gitignore | 2 +- standalone.sh => bundle.sh | 24 +++++++++------------- contrib/NickelMenu/plato | 4 +--- contrib/firmware.patch | 32 ------------------------------ contrib/plato.sh | 22 +++++--------------- crates/core/src/view/common.rs | 10 ++-------- crates/core/src/view/mod.rs | 1 - crates/core/src/view/reader/mod.rs | 1 - crates/plato/src/app.rs | 9 +-------- 9 files changed, 19 insertions(+), 86 deletions(-) rename standalone.sh => bundle.sh (50%) delete mode 100644 contrib/firmware.patch diff --git a/.gitignore b/.gitignore index ee08b6e..250af8f 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ /hyphenation-patterns /dictionaries /dist -/standalone +/bundle /plato-*.zip /thirdparty/*/* !/thirdparty/*/*kobo* diff --git a/standalone.sh b/bundle.sh similarity index 50% rename from standalone.sh rename to bundle.sh index 671d9ce..3fea891 100755 --- a/standalone.sh +++ b/bundle.sh @@ -1,23 +1,17 @@ #! /bin/sh -if [ "$#" -lt 2 ] ; then - printf "Usage: %s FIRMWARE_ARCHIVE NICKEL_MENU_ARCHIVE\n" "${0##*/}" >&2 +if [ "$#" -lt 1 ] ; then + printf "Usage: %s NICKEL_MENU_ARCHIVE\n" "${0##*/}" >&2 exit 1 fi [ -d dist ] || ./dist.sh -[ -d standalone ] && rm -Rf standalone +[ -d bundle ] && rm -Rf bundle -FIRMWARE_ARCHIVE=$1 -NICKEL_MENU_ARCHIVE=$2 +NICKEL_MENU_ARCHIVE=$1 -mkdir standalone -cd standalone || exit 1 - -unzip "$FIRMWARE_ARCHIVE" KoboRoot.tgz -tar -xzvf KoboRoot.tgz ./etc/init.d/rcS -patch -p 1 < ../contrib/firmware.patch || exit 1 -rm KoboRoot.tgz +mkdir bundle +cd bundle || exit 1 if gzip -tq "$NICKEL_MENU_ARCHIVE"; then ln -s "$NICKEL_MENU_ARCHIVE" KoboRoot.tgz @@ -34,12 +28,12 @@ mv ../dist .adds/plato cp ../contrib/NickelMenu/* .adds/nm mkdir .kobo -tar -czvf .kobo/KoboRoot.tgz etc usr -rm -Rf etc usr +tar -czvf .kobo/KoboRoot.tgz usr +rm -Rf usr FIRMWARE_VERSION=$(basename "$FIRMWARE_ARCHIVE" .zip) FIRMWARE_VERSION=${FIRMWARE_VERSION##*-} PLATO_VERSION=$(cargo pkgid -p plato | cut -d '#' -f 2) -zip -r plato-standalone-"$PLATO_VERSION"-fw_"$FIRMWARE_VERSION".zip .adds .kobo +zip -r plato-bundle-"$PLATO_VERSION".zip .adds .kobo rm -Rf .adds .kobo diff --git a/contrib/NickelMenu/plato b/contrib/NickelMenu/plato index 52d5af4..298e240 100644 --- a/contrib/NickelMenu/plato +++ b/contrib/NickelMenu/plato @@ -1,3 +1 @@ -menu_item :main :Reboot in Plato :cmd_output :200:quiet:touch /mnt/onboard/.adds/plato/bootlock -chain_success :power :reboot -menu_item :main :Start Plato :cmd_spawn :quiet:/mnt/onboard/.adds/plato/plato.sh +menu_item :main :Plato :cmd_spawn :quiet:/mnt/onboard/.adds/plato/plato.sh diff --git a/contrib/firmware.patch b/contrib/firmware.patch deleted file mode 100644 index 7bd77cd..0000000 --- a/contrib/firmware.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -ru a/etc/init.d/rcS b/etc/init.d/rcS ---- a/etc/init.d/rcS 2022-11-04 10:02:34.000000000 +0100 -+++ b/etc/init.d/rcS 2022-11-04 16:15:46.000000000 +0100 -@@ -108,7 +108,12 @@ - FS_CORRUPT=0 - dosfsck -a -w $ONBOARD_PARTITION || dosfsck -a -w $ONBOARD_PARTITION || dosfsck -a -w $ONBOARD_PARTITION || dosfsck -a -w $ONBOARD_PARTITION || FS_CORRUPT=1 - [ ! -s /usr/local/Kobo/pickel ] && FORCE_FACTORY_RESET=1 --/usr/local/Kobo/pickel should-factory-reset -+PLATO_HOME=/mnt/onboard/.adds/plato -+if [ -e "$PLATO_HOME"/bootlock ]; then -+ true -+else -+ /usr/local/Kobo/pickel should-factory-reset -+fi - if [ $? != 0 ] || [ $FS_CORRUPT == 1 ] || [ $FORCE_FACTORY_RESET == 1 ]; then - case $PRODUCT in - kraken|phoenix) -@@ -250,7 +255,12 @@ - /bin/dbus-daemon --system & - export DBUS_SESSION_BUS_ADDRESS=`/bin/dbus-daemon --session --print-address --fork` - --/usr/local/Kobo/hindenburg & --LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad & -+if [ -e "$PLATO_HOME"/bootlock -a -x "$PLATO_HOME"/plato.sh ]; then -+ PLATO_STANDALONE=1 "$PLATO_HOME"/plato.sh & -+else -+ [ -e "$PLATO_HOME"/bootlock ] && rm "$PLATO_HOME"/bootlock -+ /usr/local/Kobo/hindenburg & -+ LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad & -+fi - [ $PLATFORM != freescale ] && rm -rf /dev/mmcblk1* && udevadm trigger & - [ -e /drivers/$PLATFORM/misc/lowmem.ko ] && insmod /drivers/$PLATFORM/misc/lowmem.ko & diff --git a/contrib/plato.sh b/contrib/plato.sh index 6610194..4f2a53d 100755 --- a/contrib/plato.sh +++ b/contrib/plato.sh @@ -9,20 +9,10 @@ PLATO_CONVERT_DICTIONARIES=1 # shellcheck disable=SC1091 [ -e config.sh ] && . config.sh -if [ "$PLATO_STANDALONE" ] ; then - # Stop the animation started by rcS - REM_TRIES=10 - while [ "$REM_TRIES" -gt 0 ] ; do - killall on-animator.sh && break - REM_TRIES=$((REM_TRIES-1)) - usleep 400000 - done -else - # shellcheck disable=SC2046 - export $(grep -sE '^(INTERFACE|WIFI_MODULE|DBUS_SESSION_BUS_ADDRESS|NICKEL_HOME|LANG)=' /proc/"$(pidof -s nickel)"/environ) - sync - killall -TERM nickel hindenburg sickel fickel adobehost foxitpdf iink dhcpcd-dbus dhcpcd fmon > /dev/null 2>&1 -fi +# shellcheck disable=SC2046 +export $(grep -sE '^(INTERFACE|WIFI_MODULE|DBUS_SESSION_BUS_ADDRESS|NICKEL_HOME|LANG)=' /proc/"$(pidof -s nickel)"/environ) +sync +killall -TERM nickel hindenburg sickel fickel adobehost foxitpdf iink dhcpcd-dbus dhcpcd fmon > /dev/null 2>&1 # Turn off the LEDs # https://www.tablix.org/~avian/blog/archives/2013/03/blinken_kindle/ @@ -90,7 +80,7 @@ fi [ "$ORIG_BPP" ] && ./bin/utils/fbdepth -q -d 8 -LIBC_FATAL_STDERR_=1 ./plato >> info.log 2>&1 || rm bootlock +LIBC_FATAL_STDERR_=1 ./plato >> info.log 2>&1 [ "$ORIG_BPP" ] && ./bin/utils/fbdepth -q -d "$ORIG_BPP" @@ -98,8 +88,6 @@ if [ -e /tmp/reboot ] ; then reboot elif [ -e /tmp/power_off ] ; then poweroff -f -elif [ "$PLATO_STANDALONE" ] ; then - reboot else ./nickel.sh & fi diff --git a/crates/core/src/view/common.rs b/crates/core/src/view/common.rs index 3370077..e4a5a69 100644 --- a/crates/core/src/view/common.rs +++ b/crates/core/src/view/common.rs @@ -1,4 +1,3 @@ -use std::env; use std::sync::mpsc; use chrono::Local; use crate::device::CURRENT_DEVICE; @@ -110,13 +109,8 @@ pub fn toggle_main_menu(view: &mut dyn View, rect: Rectangle, enable: Option { self.quit(context); diff --git a/crates/plato/src/app.rs b/crates/plato/src/app.rs index d069da4..ef5de3f 100644 --- a/crates/plato/src/app.rs +++ b/crates/plato/src/app.rs @@ -1,4 +1,4 @@ -use std::fs::{self, File}; +use std::fs::File; use std::env; use std::thread; use std::process::Command; @@ -951,13 +951,6 @@ pub fn run() -> Result<(), Error> { Event::Select(EntryId::Quit) => { break; }, - Event::Select(EntryId::RebootInNickel) => { - fs::remove_file("bootlock").map_err(|e| { - eprintln!("Couldn't remove the bootlock file: {:#}.", e); - }).ok(); - exit_status = ExitStatus::Reboot; - break; - }, Event::MightSuspend if context.settings.auto_suspend > 0 => { if context.shared || tasks.iter().any(|task| task.id == TaskId::PrepareSuspend || task.id == TaskId::Suspend) { -- 2.51.2