diff --git a/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java b/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java index e96f9e10f..a94968730 100644 --- a/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java +++ b/app/src/main/java/com/topjohnwu/magisk/MagiskManager.java @@ -37,7 +37,7 @@ public class MagiskManager extends Application { public static final String INTENT_SECTION = "section"; public static final String INTENT_VERSION = "version"; public static final String INTENT_LINK = "link"; - public static final String BUSYBOX_VERSION = "1.26.2"; + public static final String BUSYBOX_VERSION = "1.27.1"; public static final String MAGISKHIDE_PROP = "persist.magisk.hide"; public static final String DISABLE_INDICATION_PROP = "ro.magisk.disable"; public static final String NOTIFICATION_CHANNEL = "magisk_update_notice"; @@ -165,6 +165,7 @@ public class MagiskManager extends Application { // Initialize busybox File busybox = new File(getApplicationInfo().dataDir + "/busybox/busybox"); if (!busybox.exists() || !TextUtils.equals(prefs.getString("busybox_version", ""), BUSYBOX_VERSION)) { + shell.su("rm -rf " + busybox.getParentFile()); busybox.getParentFile().mkdirs(); shell.su_raw( "cp -f " + new File(getApplicationInfo().nativeLibraryDir, "libbusybox.so") + " " + busybox, @@ -189,7 +190,7 @@ public class MagiskManager extends Application { .putString("busybox_version", BUSYBOX_VERSION) .apply(); // Add busybox to PATH - shell.su_raw("PATH=$PATH:" + busybox.getParent()); + shell.su_raw("PATH=" + busybox.getParent() + ":$PATH"); // Create notification channel on Android O if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java b/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java index af71d39c7..f4cce67a7 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Shell.java @@ -106,6 +106,7 @@ public class Shell { synchronized (shellProcess) { try { for (String command : commands) { + Logger.shell(command); STDIN.write((command + "\n").getBytes("UTF-8")); STDIN.flush(); } @@ -127,7 +128,7 @@ public class Shell { // This should be the expected result } synchronized (shellProcess) { - StreamGobbler out = new StreamGobbler(this.STDOUT, output); + StreamGobbler out = new StreamGobbler(STDOUT, output); out.start(); sh_raw(commands); sh_raw("echo \'-shell-done-\'");