Commit c8f65fc9 authored by topjohnwu's avatar topjohnwu

Fix selinux error while installing Magisk on some devices

parent 7684602e
...@@ -168,12 +168,12 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> { ...@@ -168,12 +168,12 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
if (isSigned) { if (isSigned) {
console.add("- Signing boot image with test keys"); console.add("- Signing boot image with test keys");
File signed = new File(installDir, "signed.img"); File signed = new File(installDir, "signed.img");
try (InputStream in = new BufferedInputStream(new FileInputStream(patched)); try (InputStream in = new SuFileInputStream(patched);
OutputStream out = new BufferedOutputStream(new FileOutputStream(signed)) OutputStream out = new BufferedOutputStream(new FileOutputStream(signed))
) { ) {
SignBoot.doSignature("/boot", in, out, null, null); SignBoot.doSignature("/boot", in, out, null, null);
} }
signed.renameTo(patched); Shell.Sync.su("mv -f " + signed + " " + patched);
} }
return patched; return patched;
} }
...@@ -194,7 +194,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> { ...@@ -194,7 +194,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
out = new BufferedOutputStream(new FileOutputStream(dest)); out = new BufferedOutputStream(new FileOutputStream(dest));
break; break;
} }
try (InputStream in = new FileInputStream(patched)) { try (InputStream in = new SuFileInputStream(patched)) {
ShellUtils.pump(in, out); ShellUtils.pump(in, out);
out.close(); out.close();
} }
...@@ -215,7 +215,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> { ...@@ -215,7 +215,7 @@ public class InstallMagisk extends ParallelTask<Void, Void, Boolean> {
mm.keepVerity ? "" : "patch_dtbo_image"); mm.keepVerity ? "" : "patch_dtbo_image");
break; break;
} }
patched.delete(); Shell.Sync.su("rm -f " + patched);
} }
@Override @Override
......
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