diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 30c04a6ee..86a10294b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -350,8 +350,6 @@ android.applicationVariants.all { } } - from(File(magiskDir, "customize.sh")) - from(File(rootDir, "LICENSE")) from(File(rootDir, "README.md")) } diff --git a/app/magisk/customize.sh b/app/magisk/customize.sh deleted file mode 100644 index 5404cc7a5..000000000 --- a/app/magisk/customize.sh +++ /dev/null @@ -1,43 +0,0 @@ -# Until Magisk supports overlayfs, we'll try to install to a non-overlayfs path -# that still supports privileged apps. -# https://github.com/topjohnwu/Magisk/pull/6588 - -has_overlays() { - local mnt="${1}" count - count=$(awk -v mnt="${mnt}" '$9 == "overlay" && $5 ~ mnt' /proc/self/mountinfo | wc -l) - [ "${count}" -gt 0 ] -} - -target= - -for mountpoint in /system /product /system_ext /vendor; do - if has_overlays "^${mountpoint}"; then - echo "Cannot use ${mountpoint}: contains overlayfs mounts" - # Magisk fails to mount files when the parent directory does not exist - elif [ ! -d "${mountpoint}/etc/permissions" ]; then - echo "Cannot use ${mountpoint}: etc/permissions/ does not exist" - elif [ ! -d "${mountpoint}/priv-app" ]; then - echo "Cannot use ${mountpoint}: priv-app/ does not exist" - else - echo "Using ${mountpoint} as the installation target" - target=${mountpoint} - break - fi -done - -if [ -z "${target}" ]; then - echo 'No suitable installation target found' - echo 'This OS is not supported' - rm -rv "${MODPATH}" 2>&1 - exit 1 -fi - -if [ "${target}" != /system ]; then - echo 'Removing addon.d script since installation target is not /system' - rm -rv "${MODPATH}/system/addon.d" 2>&1 || exit 1 - - echo "Adjusting overlay for installation to ${target}" - mv -v "${MODPATH}/system" "${MODPATH}/${target#/}" 2>&1 || exit 1 - mkdir -v "${MODPATH}/system" 2>&1 || exit 1 - mv -v "${MODPATH}/${target#/}" "${MODPATH}/system/${target#/}" 2>&1 || exit 1 -fi diff --git a/app/magisk/update-binary b/app/magisk/update-binary index 911344361..60d37d4ee 100644 --- a/app/magisk/update-binary +++ b/app/magisk/update-binary @@ -40,5 +40,20 @@ else . /data/adb/magisk/util_functions.sh + has_overlays() { + local mnt="${1}" count + count=$(awk -v mnt="${mnt}" '$9 == "overlay" && $5 ~ mnt' /proc/self/mountinfo | wc -l) + [ "${count}" -gt 0 ] + } + + # https://github.com/topjohnwu/Magisk/pull/6588 + if [ -n "${MAGISK_VER_CODE}" ]; then + ui_print "Magisk version: ${MAGISK_VER_CODE}" + if has_overlays /system && [ "${MAGISK_VER_CODE}" -lt 26000 ]; then + ui_print "Magisk v26.0 (26000) or newer is required because this device uses overlayfs" + exit 1 + fi + fi + install_module fi