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);
boolean noPatch = false;
boolean isModule = false;
boolean isAnyKernel = false;
errMessage = "File is not a valid zip file";
try (ZipInputStream zipInputStream = new ZipInputStream(
new ByteArrayInputStream(rawModule))) {
ZipEntry zipEntry;
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
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;
isModule = true;
break;
@ -175,7 +179,8 @@ public class InstallerActivity extends CompatActivity {
}
}
if (!isModule) {
this.setInstallStateFinished(false,
this.setInstallStateFinished(false, isAnyKernel ?
"! AnyKernel modules can only be installed on recovery" :
"! File is not a valid magisk module", "");
return;
}

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

Loading…
Cancel
Save