From 1d9359d5633cc988d20ced61af778b8224172f46 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 20 Mar 2019 03:20:02 -0400 Subject: [PATCH] Fix additional setup --- .../magisk/tasks/MagiskInstaller.java | 31 +++++++++---------- app/src/main/res/raw/utils.sh | 1 + 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java b/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java index 229cee471..f3c705cac 100644 --- a/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java +++ b/app/src/main/java/com/topjohnwu/magisk/tasks/MagiskInstaller.java @@ -147,12 +147,9 @@ public abstract class MagiskInstaller { name = ze.getName(); if (name == null) continue; - File dest; - if (installDir instanceof SuFile) { - dest = new SuFile(installDir, name); - } else { - dest = new File(installDir, name); - } + File dest = (installDir instanceof SuFile) ? + new SuFile(installDir, name) : + new File(installDir, name); dest.getParentFile().mkdirs(); try (OutputStream out = new SuFileOutputStream(dest)) { ShellUtils.pump(zi, out); @@ -162,6 +159,13 @@ public abstract class MagiskInstaller { console.add("! Cannot unzip zip"); return false; } + + SuFile init64 = new SuFile(installDir, "magiskinit64"); + if (Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_64_BIT_ABIS.length != 0) { + init64.renameTo(new SuFile(installDir, "magiskinit")); + } else { + init64.delete(); + } return true; } @@ -211,18 +215,13 @@ public abstract class MagiskInstaller { return false; } - Shell.Job job = Shell.sh("cd " + installDir); - if (Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_64_BIT_ABIS.length != 0) { - job.add("mv -f magiskinit64 magiskinit 2>/dev/null"); - } else { - job.add("rm -f magiskinit64 2>/dev/null"); - } - if (!job.add(Utils.fmt("KEEPFORCEENCRYPT=%b KEEPVERITY=%b " + - "sh update-binary sh boot_patch.sh %s", - Config.keepEnc, Config.keepVerity, srcBoot)).to(console, logs).exec().isSuccess()) + if (Shell.sh("cd " + installDir, Utils.fmt( + "KEEPFORCEENCRYPT=%b KEEPVERITY=%b sh update-binary sh boot_patch.sh %s", + Config.keepEnc, Config.keepVerity, srcBoot)) + .to(console, logs).exec().isSuccess()) return false; - job = Shell.sh("./magiskboot --cleanup", + Shell.Job job = Shell.sh("./magiskboot --cleanup", "mv bin/busybox busybox", "rm -rf magisk.apk bin boot.img update-binary", "cd /"); diff --git a/app/src/main/res/raw/utils.sh b/app/src/main/res/raw/utils.sh index eb1544d60..e2ab7b026 100644 --- a/app/src/main/res/raw/utils.sh +++ b/app/src/main/res/raw/utils.sh @@ -15,6 +15,7 @@ fix_env() { $MAGISKTMP/mirror/bin/busybox --install -s $MAGISKTMP/busybox rm -f update-binary magisk.apk chmod -R 755 . + ./magiskinit -x magisk magisk cd / }