From 2a30845f61d5f77ded7a72ee3d6ab55b4c512d52 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Tue, 12 Mar 2024 15:44:59 +0100 Subject: [PATCH] fix: Support mounting even when Magisk is not installed --- .../kotlin/app/revanced/library/adb/Constants.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/app/revanced/library/adb/Constants.kt b/src/main/kotlin/app/revanced/library/adb/Constants.kt index ada0a2f..fcf4971 100644 --- a/src/main/kotlin/app/revanced/library/adb/Constants.kt +++ b/src/main/kotlin/app/revanced/library/adb/Constants.kt @@ -29,13 +29,17 @@ internal object Constants { internal val MOUNT_SCRIPT = """ #!/system/bin/sh - MAGISKTMP="$( magisk --path )" || MAGISKTMP=/sbin - MIRROR="${'$'}MAGISKTMP/.magisk/mirror" + + # Use Magisk mirror, if possible. + if command -v magisk &> /dev/null; then + MIRROR="${'$'}(magisk --path)/.magisk/mirror" + fi + # Wait for the system to boot. until [ "$( getprop sys.boot_completed )" = 1 ]; do sleep 3; done until [ -d "/sdcard/Android" ]; do sleep 1; done - # Unmount any existing mount as a safety measure + # Unmount any existing mount as a safety measure. $UMOUNT base_path="$PATCHED_APK_PATH" @@ -44,7 +48,7 @@ internal object Constants { chcon u:object_r:apk_data_file:s0 ${'$'}base_path mount -o bind ${'$'}MIRROR${'$'}base_path ${'$'}stock_path - # Kill the app to force it to restart the mounted APK in case it's already running + # Kill the app to force it to restart the mounted APK in case it's currently running. $KILL """.trimIndent() }