From 4f2b04944247ded80e95cee451d32a234a764279 Mon Sep 17 00:00:00 2001 From: Kartoffel Date: Sun, 30 Oct 2022 16:58:05 +1030 Subject: [PATCH 1/2] Added support for using doas instead of sudo if sudo isnt there. --- tools/helpers/flashall | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/helpers/flashall b/tools/helpers/flashall index bd3d350..4ecf983 100644 --- a/tools/helpers/flashall +++ b/tools/helpers/flashall @@ -3,7 +3,12 @@ # reboot the modem into fastboot mode # flash kernel + rootfs and reboot echo "Sending AT+QFASTBOOT..." -sudo sh -c 'echo -ne "AT+QFASTBOOT\r" > /dev/ttyUSB2' +if command -v doas >> /dev/null; then + root=doas +else + root=sudo +fi +$root sh -c 'echo -ne "AT+QFASTBOOT\r" > /dev/ttyUSB2' fastboot oem stay fastboot flash aboot appsboot.mbn || exit "Failed to flash the bootloader" fastboot reboot @@ -15,4 +20,4 @@ fastboot flash:raw recovery boot-mdm9607.img || exit "Failed to flash recovery k fastboot flash system rootfs-mdm9607.ubi || exit "Failed to flash the system partition" fastboot flash recoveryfs recoveryfs.ubi || exit "Failed to flash the recovery partition" fastboot reboot -echo "Done!" \ No newline at end of file +echo "Done!" From 2a384746e40acd924a881631550238f9d73a2d41 Mon Sep 17 00:00:00 2001 From: Kartoffel Date: Mon, 28 Nov 2022 10:02:29 +1030 Subject: [PATCH 2/2] Updated to check if the script is run with root. --- tools/helpers/flashall | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/helpers/flashall b/tools/helpers/flashall index 4ecf983..1951818 100644 --- a/tools/helpers/flashall +++ b/tools/helpers/flashall @@ -3,12 +3,8 @@ # reboot the modem into fastboot mode # flash kernel + rootfs and reboot echo "Sending AT+QFASTBOOT..." -if command -v doas >> /dev/null; then - root=doas -else - root=sudo -fi -$root sh -c 'echo -ne "AT+QFASTBOOT\r" > /dev/ttyUSB2' +if [ $(id -u) -ne 0 ] ; then echo "This script must be run as root!" ; exit 1 ; fi +sh -c 'echo -ne "AT+QFASTBOOT\r" > /dev/ttyUSB2' fastboot oem stay fastboot flash aboot appsboot.mbn || exit "Failed to flash the bootloader" fastboot reboot