From 97de781a55f09cca631982511789e1ff95badc8f Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sun, 2 Jun 2019 19:15:47 -0300 Subject: [PATCH] AK3: resolve non-zero return code introduced by `cat /dev/zero > ` - the expected "cat: write error: No space left on device" gives a non-zero return code so always return true - devices that flash dtbo abort since the return code would get passed back to the Backend and silently fail as the final command in anykernel.sh (via `write_boot`), so catch seperately with a proper error message for other image write methods --- tools/ak3-core.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/ak3-core.sh b/tools/ak3-core.sh index e7bb4568a6d2..352ccf86aa4a 100755 --- a/tools/ak3-core.sh +++ b/tools/ak3-core.sh @@ -321,7 +321,10 @@ flash_boot() { dd if=/dev/zero of=$block $customdd 2>/dev/null; dd if=boot-new.img of=$block $customdd; else - cat boot-new.img /dev/zero > $block 2>/dev/null; + cat boot-new.img /dev/zero > $block 2>/dev/null || true; + fi; + if [ $? != 0 ]; then + abort "Flashing image failed. Aborting..."; fi; } @@ -349,7 +352,10 @@ flash_dtbo() { dd if=/dev/zero of=$dtboblock 2>/dev/null; dd if=$dtbo of=$dtboblock; else - cat $dtbo /dev/zero > $dtboblock 2>/dev/null; + cat $dtbo /dev/zero > $dtboblock 2>/dev/null || true; + fi; + if [ $? != 0 ]; then + abort "Flashing dtbo failed. Aborting..."; fi; fi; }