Improve AnyKernel support. Close #138

pull/140/head
Fox2Code 2 years ago
parent 8f5751581e
commit 1c3894e35b

@ -159,13 +159,17 @@ public class InstallerActivity extends CompatActivity {
Files.fixJavaZipHax(rawModule); Files.fixJavaZipHax(rawModule);
boolean noPatch = false; boolean noPatch = false;
boolean isModule = false; boolean isModule = false;
boolean isAnyKernel = false;
errMessage = "File is not a valid zip file"; errMessage = "File is not a valid zip file";
try (ZipInputStream zipInputStream = new ZipInputStream( try (ZipInputStream zipInputStream = new ZipInputStream(
new ByteArrayInputStream(rawModule))) { new ByteArrayInputStream(rawModule))) {
ZipEntry zipEntry; ZipEntry zipEntry;
while ((zipEntry = zipInputStream.getNextEntry()) != null) { while ((zipEntry = zipInputStream.getNextEntry()) != null) {
String entryName = zipEntry.getName(); String entryName = zipEntry.getName();
if (entryName.equals("module.prop")) { if (entryName.equals("anykernel.sh")) {
isAnyKernel = true;
break;
} else if (entryName.equals("module.prop")) {
noPatch = true; noPatch = true;
isModule = true; isModule = true;
break; break;
@ -175,7 +179,8 @@ public class InstallerActivity extends CompatActivity {
} }
} }
if (!isModule) { if (!isModule) {
this.setInstallStateFinished(false, this.setInstallStateFinished(false, isAnyKernel ?
"! AnyKernel modules can only be installed on recovery" :
"! File is not a valid magisk module", ""); "! File is not a valid magisk module", "");
return; return;
} }

@ -249,9 +249,7 @@ public class PropUtils {
if (readIdSec && local) { if (readIdSec && local) {
// Using the name for module id is not really appropriate, so beautify it a bit // Using the name for module id is not really appropriate, so beautify it a bit
moduleInfo.name = makeNameFromId(moduleInfo.id); moduleInfo.name = makeNameFromId(moduleInfo.id);
} else if (local) { // Allow local module to not declare ids } else if (!local) { // Allow local modules to not declare ids
invalid = true;
} else {
throw new IOException("Didn't read module id at least once!"); throw new IOException("Didn't read module id at least once!");
} }
} }

Loading…
Cancel
Save