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();
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 /");

View File

@ -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 /
}