Skip to content

Commit 2a30845

Browse files
committed
fix: Support mounting even when Magisk is not installed
1 parent 1b4d87e commit 2a30845

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/kotlin/app/revanced/library/adb/Constants.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ internal object Constants {
2929
internal val MOUNT_SCRIPT =
3030
"""
3131
#!/system/bin/sh
32-
MAGISKTMP="$( magisk --path )" || MAGISKTMP=/sbin
33-
MIRROR="${'$'}MAGISKTMP/.magisk/mirror"
32+
33+
# Use Magisk mirror, if possible.
34+
if command -v magisk &> /dev/null; then
35+
MIRROR="${'$'}(magisk --path)/.magisk/mirror"
36+
fi
3437
38+
# Wait for the system to boot.
3539
until [ "$( getprop sys.boot_completed )" = 1 ]; do sleep 3; done
3640
until [ -d "/sdcard/Android" ]; do sleep 1; done
3741
38-
# Unmount any existing mount as a safety measure
42+
# Unmount any existing mount as a safety measure.
3943
$UMOUNT
4044
4145
base_path="$PATCHED_APK_PATH"
@@ -44,7 +48,7 @@ internal object Constants {
4448
chcon u:object_r:apk_data_file:s0 ${'$'}base_path
4549
mount -o bind ${'$'}MIRROR${'$'}base_path ${'$'}stock_path
4650
47-
# Kill the app to force it to restart the mounted APK in case it's already running
51+
# Kill the app to force it to restart the mounted APK in case it's currently running.
4852
$KILL
4953
""".trimIndent()
5054
}

0 commit comments

Comments
 (0)