Skip to content

Commit

Permalink
Install Magisk Manager stub if not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed Jan 1, 2017
1 parent 2afd2f0 commit f8eab72
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
busybox binary
futility binary
*.jar binary
*.exe binary
*.exe binary
*.apk binary
2 changes: 2 additions & 0 deletions scripts/flash_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ 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
cp -af $INSTALLER/common/magisk.apk /data/magisk.apk
/data/magisk/busybox --install -s /data/busybox
ln -s /data/magisk/busybox /data/busybox/busybox
# Prevent issues
Expand All @@ -303,6 +304,7 @@ else
rm -rf /cache/data_bin 2>/dev/null
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/magisk.apk /cache/magisk.apk
chmod -R 755 /cache/data_bin
BINDIR=/cache/data_bin
fi
Expand Down
17 changes: 16 additions & 1 deletion scripts/magic_mask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" {} \;
Expand Down Expand Up @@ -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

Expand Down
Binary file added zip_static/common/magisk.apk
Binary file not shown.

0 comments on commit f8eab72

Please sign in to comment.