Commit aa2d9a3b authored by topjohnwu's avatar topjohnwu

Support installing to new path

parent fd6cbb13
...@@ -244,13 +244,12 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> { ...@@ -244,13 +244,12 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
console.add("*********************************"); console.add("*********************************");
break; break;
case DIRECT_MODE: case DIRECT_MODE:
// Direct flash boot image and patch dtbo if possible String binPath = mm.remoteMagiskVersionCode >= 1464 ? "/data/adb/magisk" : "/data/magisk";
Shell.getShell().run(console, logs, Shell.getShell().run(console, logs,
"rm -rf /data/magisk/*", Utils.fmt("rm -rf %s/*; mkdir -p %s; chmod 700 /data/adb", binPath, binPath),
"mkdir -p /data/magisk 2>/dev/null", Utils.fmt("mv -f %s/* %s; rm -rf %s", install, binPath, install),
"mv -f " + install + "/* /data/magisk", Utils.fmt("flash_boot_image %s %s", patched_boot, mBootLocation),
"rm -rf " + install, mm.remoteMagiskVersionCode >= 1464 ? "cp /data/magisk.img /data/adb/magisk.img" : "",
"flash_boot_image " + patched_boot + " " + mBootLocation,
"patch_dtbo_image"); "patch_dtbo_image");
break; break;
default: default:
......
...@@ -275,7 +275,8 @@ public class ShowUI { ...@@ -275,7 +275,8 @@ public class ShowUI {
Shell.su( Shell.su(
Utils.fmt("echo '%s' > /cache/%s", uninstaller.toString().replace("'", "'\\''"), Const.UNINSTALLER), Utils.fmt("echo '%s' > /cache/%s", uninstaller.toString().replace("'", "'\\''"), Const.UNINSTALLER),
Utils.fmt("echo '%s' > /data/magisk/%s", utils.toString().replace("'", "'\\''"), Const.UTIL_FUNCTIONS) Utils.fmt("echo '%s' > %s/%s", utils.toString().replace("'", "'\\''"),
mm.magiskVersionCode >= 1464 ? "/data/adb/magisk" : "/data/magisk", Const.UTIL_FUNCTIONS)
); );
try { try {
uninstaller.close(); uninstaller.close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment