From 901d22cdfab3e06badde7e4fe4948f63596c9fe6 Mon Sep 17 00:00:00 2001 From: osm0sis Date: Sun, 21 Mar 2021 19:56:29 -0300 Subject: [PATCH] scripts: add boot_patch unpack error catching - failure to unpack wasn't being caught so boot_patch would continue to build a new cpio out of nothing and attempt to repack it (identified in #4049) --- scripts/boot_patch.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index e0daab2f0..d6c6caf2b 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -86,6 +86,7 @@ ui_print "- Unpacking boot image" ./magiskboot unpack "$BOOTIMAGE" case $? in + 0 ) ;; 1 ) abort "! Unsupported/Unknown image format" ;; @@ -93,6 +94,9 @@ case $? in ui_print "- ChromeOS boot image detected" CHROMEOS=true ;; + * ) + abort "! Unable to unpack boot image" + ;; esac [ -f recovery_dtbo ] && RECOVERYMODE=true @@ -191,7 +195,7 @@ fi ################# ui_print "- Repacking boot image" -./magiskboot repack "$BOOTIMAGE" || abort "! Unable to repack boot image!" +./magiskboot repack "$BOOTIMAGE" || abort "! Unable to repack boot image" # Sign chromeos boot $CHROMEOS && sign_chromeos