Skip to content

Commit

Permalink
fix: Sign APKs correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Mar 11, 2024
1 parent f0f3e56 commit 5ff105c
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/main/kotlin/app/revanced/cli/command/PatchCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,13 @@ internal object PatchCommand : Runnable {
}

// endregion
val patcherTemporaryFilesPath = temporaryFilesPath.resolve("patcher")
val (packageName, patcherResult) = Patcher(
PatcherConfig(
apk,
temporaryFilesPath,
patcherTemporaryFilesPath,
aaptBinaryPath?.path,
temporaryFilesPath.absolutePath,
patcherTemporaryFilesPath.absolutePath,
true,
),
).use { patcher ->
Expand Down Expand Up @@ -304,21 +305,22 @@ internal object PatchCommand : Runnable {
}

// region Save

apk.copyTo(outputFilePath, overwrite = true)

patcherResult.applyTo(outputFilePath)

if (!mount) {
outputFilePath.sign(
ApkUtils.SigningOptions(
keystoreFilePath,
keyStorePassword,
alias,
password,
signer,
),
)
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
patcherResult.applyTo(this)
}.let {
if (!mount) {
sign(
it,
outputFilePath,
ApkUtils.SigningOptions(
keystoreFilePath,
keyStorePassword,
alias,
password,
signer,
),
)
}
}

logger.info("Saved to $outputFilePath")
Expand Down

0 comments on commit 5ff105c

Please sign in to comment.