Remove /.backup folder on start

This commit is contained in:
topjohnwu 2018-11-20 05:24:40 -05:00
parent de0064af47
commit 0784448c69
3 changed files with 8 additions and 6 deletions

View File

@ -79,9 +79,8 @@ mm_patch_dtbo() {
} }
restore_imgs() { restore_imgs() {
local SHA1=`grep_prop SHA1 /.backup/.magisk` local SHA1=`grep_prop SHA1 /sbin/.magisk/config`
[ -z $SHA1 ] && local SHA1=`cat /.backup/.sha1` [ -z $SHA1 ] && local SHA1=`cat /.backup/.sha1`
[ -z $SHA1 ] && local SHA1=`grep_prop #STOCKSHA1 /.backup/.magisk`
[ -z $SHA1 ] && return 1 [ -z $SHA1 ] && return 1
local STOCKBOOT=/data/stock_boot_${SHA1}.img.gz local STOCKBOOT=/data/stock_boot_${SHA1}.img.gz
local STOCKDTBO=/data/stock_dtbo.img.gz local STOCKDTBO=/data/stock_dtbo.img.gz

View File

@ -683,9 +683,6 @@ void startup() {
xmount(nullptr, "/", nullptr, MS_REMOUNT, nullptr); xmount(nullptr, "/", nullptr, MS_REMOUNT, nullptr);
// Remove some traits of Magisk
unlink(MAGISKRC);
// GSIs will have to override /sbin/adbd with /system/bin/adbd // GSIs will have to override /sbin/adbd with /system/bin/adbd
if (access("/sbin/adbd", F_OK) == 0 && access("/system/bin/adbd", F_OK) == 0) { if (access("/sbin/adbd", F_OK) == 0 && access("/system/bin/adbd", F_OK) == 0) {
umount2("/sbin/adbd", MNT_DETACH); umount2("/sbin/adbd", MNT_DETACH);
@ -710,6 +707,12 @@ void startup() {
setfilecon("/sbin", "u:object_r:rootfs:s0"); setfilecon("/sbin", "u:object_r:rootfs:s0");
sbin = xopen("/sbin", O_RDONLY | O_CLOEXEC); sbin = xopen("/sbin", O_RDONLY | O_CLOEXEC);
// Remove some traces of Magisk
unlink(MAGISKRC);
mkdir(MAGISKTMP, 0755);
cp_afc("/.backup/.magisk", MAGISKTMP "/config");
rm_rf("/.backup");
// Create applet symlinks // Create applet symlinks
for (int i = 0; applet_names[i]; ++i) { for (int i = 0; applet_names[i]; ++i) {
snprintf(buf, PATH_MAX, "/sbin/%s", applet_names[i]); snprintf(buf, PATH_MAX, "/sbin/%s", applet_names[i]);

View File

@ -153,7 +153,7 @@ grep_prop() {
getvar() { getvar() {
local VARNAME=$1 local VARNAME=$1
local VALUE= local VALUE=
VALUE=`grep_prop $VARNAME /.backup/.magisk /data/.magisk /cache/.magisk /system/.magisk` VALUE=`grep_prop $VARNAME /sbin/.magisk/config /data/.magisk /cache/.magisk /system/.magisk`
[ ! -z $VALUE ] && eval $VARNAME=\$VALUE [ ! -z $VALUE ] && eval $VARNAME=\$VALUE
} }