flash module: ignore META-INF

This commit is contained in:
vvb2060 2024-09-22 00:50:36 +08:00 committed by John Wu
parent 3414415907
commit 506961a10d
2 changed files with 4 additions and 10 deletions

View File

@ -47,20 +47,14 @@ open class FlashZip(
}
}
val isValid = try {
zipFile.unzip(installDir, "META-INF/com/google/android", true)
val script = File(installDir, "updater-script")
script.readText().contains("#MAGISK")
try {
val binary = File(installDir, "update-binary")
AppContext.assets.open("module_installer.sh").use { it.writeTo(binary) }
} catch (e: IOException) {
console.add("! Unzip error")
throw e
}
if (!isValid) {
console.add("! This zip is not a Magisk module!")
return false
}
console.add("- Installing ${mUri.displayName}")
return Shell.cmd("sh $installDir/update-binary dummy 1 \'$zipFile\'")

View File

@ -641,7 +641,7 @@ install_module() {
# Extract prop file
unzip -o "$ZIPFILE" module.prop -d $TMPDIR >&2
[ ! -f $TMPDIR/module.prop ] && abort "! Unable to extract zip file!"
[ ! -f $TMPDIR/module.prop ] && abort "! This zip is not a Magisk module!"
local MODDIRNAME=modules
$BOOTMODE && MODDIRNAME=modules_update