Skip to content

Commit

Permalink
AK3: resolve non-zero return code introduced by `cat <img> /dev/zero …
Browse files Browse the repository at this point in the history
…> <block>`

- 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
  • Loading branch information
osm0sis committed Jun 2, 2019
1 parent 5fdf659 commit 97de781
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/ak3-core.sh
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 97de781

Please sign in to comment.