Install Magisk Manager stub if not installed

This commit is contained in:
topjohnwu 2017-01-02 02:31:26 +08:00
parent 2afd2f0d3b
commit f8eab72c7a
4 changed files with 20 additions and 2 deletions

1
.gitattributes vendored
View File

@ -14,3 +14,4 @@ busybox binary
futility binary futility binary
*.jar binary *.jar binary
*.exe binary *.exe binary
*.apk binary

View File

@ -291,6 +291,7 @@ if (is_mounted /data); then
mkdir -p /data/busybox mkdir -p /data/busybox
cp -af $BINDIR /data/magisk cp -af $BINDIR /data/magisk
cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /data/magisk cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /data/magisk
cp -af $INSTALLER/common/magisk.apk /data/magisk.apk
/data/magisk/busybox --install -s /data/busybox /data/magisk/busybox --install -s /data/busybox
ln -s /data/magisk/busybox /data/busybox/busybox ln -s /data/magisk/busybox /data/busybox/busybox
# Prevent issues # Prevent issues
@ -303,6 +304,7 @@ else
rm -rf /cache/data_bin 2>/dev/null rm -rf /cache/data_bin 2>/dev/null
cp -af $BINDIR /cache/data_bin cp -af $BINDIR /cache/data_bin
cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /cache/data_bin cp -af $INSTALLER/common/init.magisk.rc $INSTALLER/common/magic_mask.sh /cache/data_bin
cp -af $INSTALLER/common/magisk.apk /cache/magisk.apk
chmod -R 755 /cache/data_bin chmod -R 755 /cache/data_bin
BINDIR=/cache/data_bin BINDIR=/cache/data_bin
fi fi

View File

@ -280,7 +280,8 @@ case $1 in
rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot
fi fi
mv /cache/stock_boot.img /data 2>/dev/null mv /cache/stock_boot.img /data/stock_boot.img 2>/dev/null
mv /cache/magisk.apk /data/magisk.apk 2>/dev/null
find $BINPATH -exec chcon -h "u:object_r:system_file:s0" {} \; find $BINPATH -exec chcon -h "u:object_r:system_file:s0" {} \;
find $TOOLPATH -exec chcon -h "u:object_r:system_file:s0" {} \; find $TOOLPATH -exec chcon -h "u:object_r:system_file:s0" {} \;
@ -435,6 +436,20 @@ case $1 in
bind_mount $COREDIR/busybox /system/xbin bind_mount $COREDIR/busybox /system/xbin
fi fi
if [ -f /data/magisk.apk ]; then
if [ -z `ls /data/app | grep com.topjohnwu.magisk` ]; then
mkdir /data/app/com.topjohnwu.magisk-1
cp /data/magisk.apk /data/app/com.topjohnwu.magisk-1/base.apk
chown 1000.1000 /data/app/com.topjohnwu.magisk-1
chown 1000.1000 /data/app/com.topjohnwu.magisk-1/base.apk
chmod 755 /data/app/com.topjohnwu.magisk-1
chmod 644 /data/app/com.topjohnwu.magisk-1/base.apk
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1
chcon u:object_r:apk_data_file:s0 /data/app/com.topjohnwu.magisk-1/base.apk
fi
rm -f /data/magisk.apk 2>/dev/null
fi
# Restart post-fs-data if necessary (multirom) # Restart post-fs-data if necessary (multirom)
$MULTIROM && setprop magisk.restart_pfsd 1 $MULTIROM && setprop magisk.restart_pfsd 1

Binary file not shown.