Fix additional setup

This commit is contained in:
topjohnwu 2019-03-20 03:20:02 -04:00
parent 945f88105f
commit 1d9359d563
2 changed files with 16 additions and 16 deletions

View File

@ -147,12 +147,9 @@ public abstract class MagiskInstaller {
name = ze.getName(); name = ze.getName();
if (name == null) if (name == null)
continue; continue;
File dest; File dest = (installDir instanceof SuFile) ?
if (installDir instanceof SuFile) { new SuFile(installDir, name) :
dest = new SuFile(installDir, name); new File(installDir, name);
} else {
dest = new File(installDir, name);
}
dest.getParentFile().mkdirs(); dest.getParentFile().mkdirs();
try (OutputStream out = new SuFileOutputStream(dest)) { try (OutputStream out = new SuFileOutputStream(dest)) {
ShellUtils.pump(zi, out); ShellUtils.pump(zi, out);
@ -162,6 +159,13 @@ public abstract class MagiskInstaller {
console.add("! Cannot unzip zip"); console.add("! Cannot unzip zip");
return false; 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; return true;
} }
@ -211,18 +215,13 @@ public abstract class MagiskInstaller {
return false; return false;
} }
Shell.Job job = Shell.sh("cd " + installDir); if (Shell.sh("cd " + installDir, Utils.fmt(
if (Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_64_BIT_ABIS.length != 0) { "KEEPFORCEENCRYPT=%b KEEPVERITY=%b sh update-binary sh boot_patch.sh %s",
job.add("mv -f magiskinit64 magiskinit 2>/dev/null"); Config.keepEnc, Config.keepVerity, srcBoot))
} else { .to(console, logs).exec().isSuccess())
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())
return false; return false;
job = Shell.sh("./magiskboot --cleanup", Shell.Job job = Shell.sh("./magiskboot --cleanup",
"mv bin/busybox busybox", "mv bin/busybox busybox",
"rm -rf magisk.apk bin boot.img update-binary", "rm -rf magisk.apk bin boot.img update-binary",
"cd /"); "cd /");

View File

@ -15,6 +15,7 @@ fix_env() {
$MAGISKTMP/mirror/bin/busybox --install -s $MAGISKTMP/busybox $MAGISKTMP/mirror/bin/busybox --install -s $MAGISKTMP/busybox
rm -f update-binary magisk.apk rm -f update-binary magisk.apk
chmod -R 755 . chmod -R 755 .
./magiskinit -x magisk magisk
cd / cd /
} }