Skip to content

Commit

Permalink
flash module: ignore META-INF
Browse files Browse the repository at this point in the history
  • Loading branch information
vvb2060 authored and topjohnwu committed Dec 12, 2024
1 parent 3414415 commit 506961a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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\'")
Expand Down
2 changes: 1 addition & 1 deletion scripts/util_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 506961a

Please sign in to comment.