diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh index ceb2266f3..2032111b8 100644 --- a/scripts/boot_patch.sh +++ b/scripts/boot_patch.sh @@ -91,15 +91,14 @@ cpio_mkdir() { # Initialization ########################################################################################## +[ -z $1 ] && abort_wrap "This script requires a boot image as a parameter" + CWD=`pwd` cd "`dirname_wrap $1`" BOOTIMAGE="`pwd`/`basename_wrap $1`" cd "$CWD" -if [ -z "$BOOTIMAGE" ]; then - ui_print_wrap "This script requires a boot image as a parameter" - exit 1 -fi +[ -e "$BOOTIMAGE" ] || abort_wrap "$BOOTIMAGE does not exist!" # Presets [ -z $KEEPVERITY ] && KEEPVERITY=false @@ -115,11 +114,11 @@ chmod +x ./* ########################################################################################## # Unpack ########################################################################################## +CHROMEOS=false ui_print_wrap "- Unpacking boot image" ./magiskboot --unpack "$BOOTIMAGE" -CHROMEOS=false case $? in 1 ) abort_wrap "! Unable to unpack boot image" diff --git a/scripts/update_binary.sh b/scripts/update_binary.sh index 938b0295a..7058768a2 100644 --- a/scripts/update_binary.sh +++ b/scripts/update_binary.sh @@ -1,7 +1,10 @@ # EX_ARM, EX_X86, BB_ARM, and BB_X86 should be generated in build.py -TMPDIR=/dev/tmp; INSTALLER=$TMPDIR/install; BBDIR=$TMPDIR/bin +[ "$1" = "indep" ] && INDEP=true || INDEP=false +$INDEP && TMPDIR=/data/local/tmp || TMPDIR=/dev/tmp +INSTALLER=$TMPDIR/install; BBDIR=$TMPDIR/bin EXBIN=$BBDIR/b64xz; BBBIN=$BBDIR/busybox -rm -rf $TMPDIR 2>/dev/null; mkdir -p $BBDIR +$INDEP || rm -rf $TMPDIR 2>/dev/null; +mkdir -p $BBDIR 2>/dev/null touch $EXBIN $BBBIN; chmod 755 $EXBIN $BBBIN echo -ne $EX_ARM > $EXBIN if $EXBIN --test 2>/dev/null; then @@ -12,6 +15,11 @@ else fi $BBBIN --install -s $TMPDIR/bin export PATH=$BBDIR:$PATH -mkdir -p $INSTALLER -unzip -o "$3" -d $INSTALLER -exec sh $INSTALLER/META-INF/com/google/android/updater-script $@ +if $INDEP; then + shift + exec sh $@ +else + mkdir -p $INSTALLER + unzip -o "$3" -d $INSTALLER + exec sh $INSTALLER/META-INF/com/google/android/updater-script $@ +fi