Skip to content

Commit

Permalink
fix: Support mounting even when Magisk is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Mar 12, 2024
1 parent 1b4d87e commit 2a30845
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/kotlin/app/revanced/library/adb/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()
}

0 comments on commit 2a30845

Please sign in to comment.