diff --git a/scripts/app_functions.sh b/scripts/app_functions.sh index aa82eb277..75f6be857 100644 --- a/scripts/app_functions.sh +++ b/scripts/app_functions.sh @@ -43,7 +43,7 @@ fix_env() { # Cleanup and make dirs rm -rf $MAGISKBIN/* mkdir -p $MAGISKBIN 2>/dev/null - chmod 700 $NVBASE + chmod 700 /data/adb cp_readlink $1 $MAGISKBIN rm -rf $1 chown -R 0:0 $MAGISKBIN @@ -97,7 +97,7 @@ restore_imgs() { } post_ota() { - cd $NVBASE + cd /data/adb cp -f $1 bootctl rm -f $1 chmod 755 bootctl @@ -116,8 +116,8 @@ EOF add_hosts_module() { # Do not touch existing hosts module - [ -d $NVBASE/modules/hosts ] && return - cd $NVBASE/modules + [ -d /data/adb/modules/hosts ] && return + cd /data/adb/modules mkdir -p hosts/system/etc cat << EOF > hosts/module.prop id=hosts diff --git a/scripts/avd_magisk.sh b/scripts/avd_magisk.sh index a42d70efa..e08b8bf35 100755 --- a/scripts/avd_magisk.sh +++ b/scripts/avd_magisk.sh @@ -123,9 +123,9 @@ fi # Magisk stuff mkdir -p $MAGISKBIN 2>/dev/null unzip -oj magisk.apk 'assets/*.sh' -d $MAGISKBIN -mkdir $NVBASE/modules 2>/dev/null -mkdir $NVBASE/post-fs-data.d 2>/dev/null -mkdir $NVBASE/service.d 2>/dev/null +mkdir /data/adb/modules 2>/dev/null +mkdir /data/adb/post-fs-data.d 2>/dev/null +mkdir /data/adb/service.d 2>/dev/null for file in magisk magisk32 magiskpolicy stub.apk; do chmod 755 ./$file diff --git a/scripts/util_functions.sh b/scripts/util_functions.sh index b942afbff..243ed931e 100644 --- a/scripts/util_functions.sh +++ b/scripts/util_functions.sh @@ -14,10 +14,6 @@ # The path to store temporary files that don't need to persist # TMPDIR= -# The path to store files that can be persisted (non-volatile storage) -# Any modification to this variable should go through the function `set_nvbase` -# NVBASE= - # The non-volatile path where magisk executables are stored # MAGISKBIN= @@ -84,11 +80,6 @@ abort() { exit 1 } -set_nvbase() { - NVBASE="$1" - MAGISKBIN="$1/magisk" -} - print_title() { local len line1len line2len bar line1len=$(echo -n $1 | wc -c) @@ -527,9 +518,9 @@ check_data() { $DATA && [ -d /data/adb ] && touch /data/adb/.rw && rm /data/adb/.rw && DATA_DE=true $DATA_DE && [ -d /data/adb/magisk ] || mkdir /data/adb/magisk || DATA_DE=false fi - set_nvbase "/data" - $DATA || set_nvbase "/cache/data_adb" - $DATA_DE && set_nvbase "/data/adb" + MAGISKBIN="/data/magisk" + $DATA || MAGISKBIN="/cache/data_adb/magisk" + $DATA_DE && MAGISKBIN="/data/adb/magisk" } run_migrations() { @@ -575,7 +566,7 @@ copy_preinit_files() { fi # Copy all enabled sepolicy.rule - for r in $NVBASE/modules*/*/sepolicy.rule; do + for r in /data/adb/modules*/*/sepolicy.rule; do [ -f "$r" ] || continue local MODDIR=${r%/*} [ -f $MODDIR/disable ] && continue @@ -645,7 +636,7 @@ install_module() { local MODDIRNAME=modules $BOOTMODE && MODDIRNAME=modules_update - local MODULEROOT=$NVBASE/$MODDIRNAME + local MODULEROOT=/data/adb/$MODDIRNAME MODID=$(grep_prop id $TMPDIR/module.prop) MODNAME=$(grep_prop name $TMPDIR/module.prop) MODAUTH=$(grep_prop author $TMPDIR/module.prop) @@ -704,10 +695,10 @@ install_module() { if $BOOTMODE; then # Update info for Magisk app - mktouch $NVBASE/modules/$MODID/update - rm -rf $NVBASE/modules/$MODID/remove 2>/dev/null - rm -rf $NVBASE/modules/$MODID/disable 2>/dev/null - cp -af $MODPATH/module.prop $NVBASE/modules/$MODID/module.prop + mktouch /data/adb/modules/$MODID/update + rm -rf /data/adb/modules/$MODID/remove 2>/dev/null + rm -rf /data/adb/modules/$MODID/disable 2>/dev/null + cp -af $MODPATH/module.prop /data/adb/modules/$MODID/module.prop fi # Copy over custom sepolicy rules @@ -739,4 +730,4 @@ install_module() { [ -z $BOOTMODE ] && BOOTMODE=false TMPDIR=/dev/tmp -set_nvbase "/data/adb" +MAGISKBIN="/data/adb/magisk"