diff --git a/.gitattributes b/.gitattributes index c8522ae7b..457285960 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,4 +13,5 @@ busybox binary futility binary *.jar binary -*.exe binary \ No newline at end of file +*.exe binary +*.apk binary diff --git a/scripts/flash_script.sh b/scripts/flash_script.sh index d9db5ad55..5d8793d84 100644 --- a/scripts/flash_script.sh +++ b/scripts/flash_script.sh @@ -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 @@ -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 diff --git a/scripts/magic_mask.sh b/scripts/magic_mask.sh index f91160a1a..227a816d3 100644 --- a/scripts/magic_mask.sh +++ b/scripts/magic_mask.sh @@ -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 diff --git a/zip_static/common/magisk.apk b/zip_static/common/magisk.apk new file mode 100644 index 000000000..6913d406c Binary files /dev/null and b/zip_static/common/magisk.apk differ