From b5e2f706f1199759aa5abdf670a989d923b60d15 Mon Sep 17 00:00:00 2001 From: Shaun Inman Date: Mon, 6 Feb 2023 21:11:53 -0500 Subject: [PATCH] the update itself now finishes the update/install --- makefile | 1 + src/boot/boot.sh | 46 ++----------------------------------- src/install/install.sh | 52 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 44 deletions(-) create mode 100755 src/install/install.sh diff --git a/makefile b/makefile index 2311b4d..9d88117 100644 --- a/makefile +++ b/makefile @@ -54,6 +54,7 @@ bundle: cp ./src/boot/output/dmenu.bin ./build/BASE cp ./src/boot/output/dmenu.bin ./build/SYSTEM/rg35xx/dat + cp ./src/install/install.sh ./build/SYSTEM/rg35xx/bin echo "$(BUILD_HASH)" > ./build/SYSTEM/commit.txt # populate system diff --git a/src/boot/boot.sh b/src/boot/boot.sh index 44e7c07..54225a6 100755 --- a/src/boot/boot.sh +++ b/src/boot/boot.sh @@ -52,54 +52,12 @@ if [ -f $UPDATE_PATH ]; then dd if=/tmp/$ACTION of=/dev/fb0 sync - # TODO: move this logic into MinUI.zip contents? - busybox unzip -o $UPDATE_PATH -d $SDCARD_PATH rm -f $UPDATE_PATH - if [ ! -f $FLAG_PATH ]; then - BAK_PATH=$TF1_PATH/bak - mkdir -p $BAK_PATH - cp /misc/modules/gpio_keys_polled.ko $BAK_PATH - cp /misc/boot_logo.bmp.gz $BAK_PATH - cp /misc/kernel.dtb $BAK_PATH - cp /misc/uImage $BAK_PATH - fi - was_updated() { - for FILE in /misc/* /misc/*/*; do - A_PATH=$FILE - B_PATH=$SYSTEM_PATH/dat/$(busybox basename "$A_PATH") - - if [ ! -f "$B_PATH" ]; then - continue - fi - - A_SUM=$(busybox md5sum $A_PATH | busybox cut -d ' ' -f 1) - B_SUM=$(busybox md5sum $B_PATH | busybox cut -d ' ' -f 1) - - if [[ "$A_SUM" != "$B_SUM" ]]; then - return 0 - fi - done - - return 1 - } + # the updated system finishes the install/update + $SYSTEM_PATH/bin/install.sh - if [ ! -f $FLAG_PATH ] || was_updated; then - echo "updating misc partition" - mount -o remount,rw /dev/block/actb /misc - rm -f /misc/uImage - cp $SYSTEM_PATH/dat/uImage /misc - cp $SYSTEM_PATH/dat/dmenu.bin /misc - if [ ! -f $FLAG_PATH ]; then - # only replace boot logo on install not update - cp $SYSTEM_PATH/dat/boot_logo.bmp.gz /misc - fi - cp $SYSTEM_PATH/dat/kernel.dtb /misc - cp $SYSTEM_PATH/dat/gpio_keys_polled.ko /misc/modules - touch $FLAG_PATH - sync && reboot - fi } &> /mnt/sdcard/install.txt fi diff --git a/src/install/install.sh b/src/install/install.sh new file mode 100755 index 0000000..d844ea7 --- /dev/null +++ b/src/install/install.sh @@ -0,0 +1,52 @@ +#!/system/bin/sh + +# NOTE: this file is not chrooted so it's using stock's everything! + +TF1_PATH=/mnt/mmc +TF2_PATH=/mnt/sdcard # TF1 is linked to this path if TF2 is missing +SYSTEM_PATH=/mnt/sdcard/.system/rg35xx + +if [ ! -f $FLAG_PATH ]; then + BAK_PATH=$TF1_PATH/bak + mkdir -p $BAK_PATH + cp /misc/modules/gpio_keys_polled.ko $BAK_PATH + cp /misc/boot_logo.bmp.gz $BAK_PATH + cp /misc/kernel.dtb $BAK_PATH + cp /misc/uImage $BAK_PATH +fi + +was_updated() { + for FILE in /misc/* /misc/*/*; do + A_PATH=$FILE + B_PATH=$SYSTEM_PATH/dat/$(busybox basename "$A_PATH") + + if [ ! -f "$B_PATH" ]; then + continue + fi + + A_SUM=$(busybox md5sum $A_PATH | busybox cut -d ' ' -f 1) + B_SUM=$(busybox md5sum $B_PATH | busybox cut -d ' ' -f 1) + + if [[ "$A_SUM" != "$B_SUM" ]]; then + return 0 + fi + done + + return 1 +} + +if [ ! -f $FLAG_PATH ] || was_updated; then + echo "updating misc partition" + mount -o remount,rw /dev/block/actb /misc + rm -f /misc/uImage + cp $SYSTEM_PATH/dat/uImage /misc + cp $SYSTEM_PATH/dat/dmenu.bin /misc + if [ ! -f $FLAG_PATH ]; then + # only replace boot logo on install not update! + cp $SYSTEM_PATH/dat/boot_logo.bmp.gz /misc + fi + cp $SYSTEM_PATH/dat/kernel.dtb /misc + cp $SYSTEM_PATH/dat/gpio_keys_polled.ko /misc/modules + touch $FLAG_PATH + sync && reboot +fi \ No newline at end of file