From 3009f65ec8928a84163039727930c70272e6d3d4 Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Thu, 20 Apr 2023 13:40:28 -0400 Subject: [PATCH] customize.sh: Remove overlayfs workaround Users with devices that use overlayfs for `/system` must upgrade to Magisk 26.0 or newer. Signed-off-by: Andrew Gunnerson --- app/magisk/customize.sh | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/app/magisk/customize.sh b/app/magisk/customize.sh index 5404cc7a5..bd70752e7 100644 --- a/app/magisk/customize.sh +++ b/app/magisk/customize.sh @@ -8,36 +8,11 @@ has_overlays() { [ "${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 +if [ -n "${MAGISK_VER_CODE}"]; then + echo "Magisk version: ${MAGISK_VER_CODE}" + if has_overlays /system && [ "${MAGISK_VER_CODE}" -lt 26000 ]; then + echo "Magisk v26.0 (26000) or newer is required because this device uses overlayfs" + rm -rv "${MODPATH}" 2>&1 + exit 1 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