From f3ac787f5a0e95f11ee94e0528ccd334e760dd95 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 23 Apr 2020 01:40:50 +0530 Subject: ToolsInstaller: update Magisk directory /data/adb/modules has been the location for modules since v18.0 and nobody should reasonably be on any older version anymore. This has continued to work for this long because Magisk created symlinks for backwards compat. However, these symlinks are not created anymore on Android 11, which is where this problem first surfaced. Signed-off-by: Harsh Shandilya --- .../main/java/com/wireguard/android/util/ToolsInstaller.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tunnel/src/main/java/com') diff --git a/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java b/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java index 81e9ebeb..37f00a37 100644 --- a/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java +++ b/tunnel/src/main/java/com/wireguard/android/util/ToolsInstaller.java @@ -143,12 +143,12 @@ public final class ToolsInstaller { extract(); final StringBuilder script = new StringBuilder("set -ex; "); - script.append("trap 'rm -rf /sbin/.magisk/img/wireguard' INT TERM EXIT; "); - script.append(String.format("rm -rf /sbin/.magisk/img/wireguard/; mkdir -p /sbin/.magisk/img/wireguard%s; ", INSTALL_DIR)); - script.append("printf 'name=WireGuard Command Line Tools\nversion=1.0\nversionCode=1\nauthor=zx2c4\ndescription=Command line tools for WireGuard\nminMagisk=1500\n' > /sbin/.magisk/img/wireguard/module.prop; "); - script.append("touch /sbin/.magisk/img/wireguard/auto_mount; "); + script.append("trap 'rm -rf /data/adb/moduleswireguard' INT TERM EXIT; "); + script.append(String.format("rm -rf /data/adb/modules/wireguard/; mkdir -p /data/adb/modules/wireguard%s; ", INSTALL_DIR)); + script.append("printf 'name=WireGuard Command Line Tools\nversion=1.0\nversionCode=1\nauthor=zx2c4\ndescription=Command line tools for WireGuard\nminMagisk=1500\n' > /data/adb/modules/wireguard/module.prop; "); + script.append("touch /data/adb/modules/wireguard/auto_mount; "); for (final String name : EXECUTABLES) { - final File destination = new File("/sbin/.magisk/img/wireguard" + INSTALL_DIR, name); + final File destination = new File("/data/adb/modules/wireguard" + INSTALL_DIR, name); script.append(String.format("cp '%s' '%s'; chmod 755 '%s'; chcon 'u:object_r:system_file:s0' '%s' || true; ", new File(localBinaryDir, name), destination, destination, destination)); } @@ -191,7 +191,7 @@ public final class ToolsInstaller { synchronized (lock) { if (installAsMagiskModule == null) { try { - installAsMagiskModule = rootShell.run(null, "[ -d /sbin/.magisk/mirror -a -d /sbin/.magisk/img -a ! -f /cache/.disable_magisk ]") == OsConstants.EXIT_SUCCESS; + installAsMagiskModule = rootShell.run(null, "[ -d /data/adb/modules -a ! -f /cache/.disable_magisk ]") == OsConstants.EXIT_SUCCESS; } catch (final Exception ignored) { installAsMagiskModule = false; } -- cgit v1.2.3