From 5921d3a42a5fe48f796c812d4f25b9d53e272095 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sun, 13 Nov 2016 21:02:35 +0800 Subject: [PATCH] Update scripts --- scripts/flash_script.sh | 11 ++--------- scripts/magic_mask.sh | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 20 deletions(-) diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index 20bb82694..887080f2e 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -249,6 +249,7 @@ fi ui_print "- Device platform: $ARCH" BINDIR=$INSTALLER/$ARCH +chmod -R 755 $CHROMEDIR/futility $BINDIR find_boot_image if [ -z "$BOOTIMAGE" ]; then @@ -267,13 +268,11 @@ if (is_mounted /data); then mkdir -p /data/busybox cp -af $BINDIR /data/magisk cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /data/magisk - chmod -R 755 /data/magisk - chcon -R "u:object_r:system_file:s0" /data/magisk /data/magisk/busybox --install -s /data/busybox ln -s /data/magisk/busybox /data/busybox/busybox # Prevent issues rm -f /data/busybox/su /data/busybox/sh - chcon -R "u:object_r:system_file:s0" /data/magisk /data/busybox + chcon -hR "u:object_r:system_file:s0" /data/magisk /data/busybox chmod -R 755 /data/magisk /data/busybox PATH=/data/busybox:$PATH else @@ -314,10 +313,6 @@ MAGISKLOOP=$LOOPDEVICE mkdir -p /magisk/.core/magiskhide 2>/dev/null cp -af $INSTALLER/common/magiskhide/. /magisk/.core/magiskhide -# Remove legacy SuperSU module -mkdir -p /magisk/zzsupersu -touch /magisk/zzsupersu/remove - ########################################################################################## # Boot image patch ########################################################################################## @@ -332,8 +327,6 @@ NEWBOOT=$TMPDIR/boottmp/new-boot.img UNPACKDIR=$TMPDIR/boottmp/bootunpack RAMDISK=$TMPDIR/boottmp/ramdisk -chmod 777 $CHROMEDIR/futility $BINDIR/* - ORIGBOOT=$BOOTIMAGE ui_print "- Unpacking boot image" diff --git a/scripts/magic_mask.sh b/scripts/magic_mask.sh index 06002fee0..7647fff45 100644 --- a/scripts/magic_mask.sh +++ b/scripts/magic_mask.sh @@ -237,20 +237,19 @@ case $1 in log_print "** Magisk post-fs mode running..." - # Cleanup previous stuffs... + # Cleanup previous version stuffs... rm -rf /cache/magisk /cache/magisk_merge /cache/magiskhide.log - if [ -d "/cache/magisk_bootanim" ]; then - log_print "Mounting custom Boot Animation" - find /cache/magisk_bootanim -type f 2>/dev/null | while read ITEM ; do + if [ -d "/cache/magisk_mount" ]; then + log_print "Mounting cache files" + find /cache/magisk_mount -type f 2>/dev/null | while read ITEM ; do chmod 644 "$ITEM" chcon "u:object_r:system_file:s0" "$ITEM" - TARGET="${ITEM#/cache/magisk_bootanim}" + TARGET="${ITEM#/cache/magisk_mount}" bind_mount "$ITEM" "$TARGET" done fi - unblock ;; @@ -290,7 +289,7 @@ case $1 in mv /cache/stock_boot.img /data 2>/dev/null - chcon -R "u:object_r:system_file:s0" $BINPATH $TOOLPATH + chcon -hR "u:object_r:system_file:s0" $BINPATH $TOOLPATH chmod -R 755 $BINPATH $TOOLPATH # Image merging @@ -318,7 +317,7 @@ case $1 in # Remove modules for MOD in $MOUNTPOINT/* ; do - if [ -f "$MOD/remove" ]; then + if [ -f "$MOD/remove" ] || [ "$MOD" = "zzsupersu" ]; then log_print "Remove module: $MOD" rm -rf $MOD fi @@ -377,7 +376,7 @@ case $1 in done # Proper permissions for generated items - chcon -R "u:object_r:system_file:s0" $TMPDIR + chcon -hR "u:object_r:system_file:s0" $TMPDIR # Stage 2 log_print "Bind mount module items" @@ -402,8 +401,8 @@ case $1 in log_print "Enabling BusyBox" $TOOLPATH/cp -afc /data/busybox/. $COREDIR/busybox $TOOLPATH/cp -afc /system/xbin/. $COREDIR/busybox - chmod 755 $COREDIR/busybox - chcon "u:object_r:system_file:s0" $COREDIR/busybox + chmod -R 755 $COREDIR/busybox + chcon -hR "u:object_r:system_file:s0" $COREDIR/busybox bind_mount $COREDIR/busybox /system/xbin fi