From c421e45fa03ca39dd84a14cac550dee128ae4966 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 12 Mar 2017 19:22:15 +0800 Subject: [PATCH] Small improvements and bug fixes --- jni/magiskboot/cpio.c | 2 +- scripts/flash_script.sh | 19 ++++++++----------- scripts/magisk_uninstaller.sh | 7 +++---- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/jni/magiskboot/cpio.c b/jni/magiskboot/cpio.c index 8c69eea16..199fdc026 100644 --- a/jni/magiskboot/cpio.c +++ b/jni/magiskboot/cpio.c @@ -196,7 +196,7 @@ static void cpio_test(vector *v) { vec_for_each(v, f) { if (strcmp(f->filename, "sbin/launch_daemonsu.sh") == 0) { if (!ret) ret = 2; - } else if (strcmp(f->filename, "magisk") == 0) { + } else if (strcmp(f->filename, "init.magisk.rc") == 0) { ret = 1; break; } diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index 6248e6735..f91b742bd 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -198,12 +198,8 @@ getvar KEEPVERITY getvar KEEPFORCEENCRYPT getvar BOOTIMAGE -if [ -z "$KEEPVERITY" ]; then - KEEPVERITY=false -fi -if [ -z "$KEEPFORCEENCRYPT" ]; then - KEEPFORCEENCRYPT=false -fi +[ -z $KEEPVERITY ] && KEEPVERITY=false +[ -z $KEEPFORCEENCRYPT ] && KEEPFORCEENCRYPT=false # Check if system root is installed and remove remove_system_su @@ -229,13 +225,13 @@ fi ui_print "- Device platform: $ARCH" BINDIR=$INSTALLER/$ARCH -chmod -R 755 $CHROMEDIR/futility $BINDIR +chmod -R 755 $CHROMEDIR $BINDIR SYSTEMLIB=/system/lib $IS64BIT && SYSTEMLIB=/system/lib64 find_boot_image -if [ -z "$BOOTIMAGE" ]; then +if [ -z $BOOTIMAGE ]; then ui_print "! Unable to detect boot image" exit 1 fi @@ -258,6 +254,7 @@ chmod -R 755 $MAGISKBIN chcon -h u:object_r:system_file:s0 $MAGISKBIN $MAGISKBIN/* # Temporary busybox for installation +rm -rf $TMPDIR/busybox 2>/dev/null mkdir -p $TMPDIR/busybox $BINDIR/busybox --install -s $TMPDIR/busybox rm -f $TMPDIR/busybox/su $TMPDIR/busybox/sh $TMPDIR/busybox/reboot @@ -456,9 +453,9 @@ esac # Sign chromeos boot if [ -f chromeos ]; then - cp -af $CHROMEDIR/. $MAGISKBIN/chromeos - echo " " > config - echo " " > bootloader + cp -af $CHROMEDIR/. $MAGISKBIN/chromeos + echo > config + echo > bootloader LD_LIBRARY_PATH=$SYSTEMLIB $CHROMEDIR/futility vbutil_kernel --pack new-boot.img.signed --keyblock $CHROMEDIR/kernel.keyblock --signprivate $CHROMEDIR/kernel_data_key.vbprivk --version 1 --vmlinuz new-boot.img --config config --arch arm --bootloader bootloader --flags 0x1 rm -f new-boot.img mv new-boot.img.signed new-boot.img diff --git a/scripts/magisk_uninstaller.sh b/scripts/magisk_uninstaller.sh index ae24b9c58..fd50436eb 100644 --- a/scripts/magisk_uninstaller.sh +++ b/scripts/magisk_uninstaller.sh @@ -114,12 +114,11 @@ esac # Sign chromeos boot if [ -f chromeos ]; then - cp -af $CHROMEDIR/. $MAGISKBIN/chromeos echo > config echo > bootloader - LD_LIBRARY_PATH=$SYSTEMLIB $CHROMEDIR/futility vbutil_kernel --pack new-boot.img.signed --keyblock $CHROMEDIR/kernel.keyblock --signprivate $CHROMEDIR/kernel_data_key.vbprivk --version 1 --vmlinuz new-boot.img --config config --arch arm --bootloader bootloader --flags 0x1 - rm -f new-boot.img - mv new-boot.img.signed new-boot.img + LD_LIBRARY_PATH=$SYSTEMLIB $CHROMEDIR/futility vbutil_kernel --pack stock_boot.img.signed --keyblock $CHROMEDIR/kernel.keyblock --signprivate $CHROMEDIR/kernel_data_key.vbprivk --version 1 --vmlinuz stock_boot.img --config config --arch arm --bootloader bootloader --flags 0x1 + rm -f stock_boot.img + mv stock_boot.img.signed stock_boot.img fi ui_print_wrapper "- Flashing stock/reverted image"