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

View File

@@ -280,7 +280,8 @@ case $1 in
rm -f $TOOLPATH/su $TOOLPATH/sh $TOOLPATH/reboot
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 $TOOLPATH -exec chcon -h "u:object_r:system_file:s0" {} \;
@@ -435,6 +436,20 @@ case $1 in
bind_mount $COREDIR/busybox /system/xbin
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)
$MULTIROM && setprop magisk.restart_pfsd 1