Skip to content

Commit 5ff105c

Browse files
committed
fix: Sign APKs correctly
1 parent f0f3e56 commit 5ff105c

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

src/main/kotlin/app/revanced/cli/command/PatchCommand.kt

+19-17
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,13 @@ internal object PatchCommand : Runnable {
262262
}
263263

264264
// endregion
265+
val patcherTemporaryFilesPath = temporaryFilesPath.resolve("patcher")
265266
val (packageName, patcherResult) = Patcher(
266267
PatcherConfig(
267268
apk,
268-
temporaryFilesPath,
269+
patcherTemporaryFilesPath,
269270
aaptBinaryPath?.path,
270-
temporaryFilesPath.absolutePath,
271+
patcherTemporaryFilesPath.absolutePath,
271272
true,
272273
),
273274
).use { patcher ->
@@ -304,21 +305,22 @@ internal object PatchCommand : Runnable {
304305
}
305306

306307
// region Save
307-
308-
apk.copyTo(outputFilePath, overwrite = true)
309-
310-
patcherResult.applyTo(outputFilePath)
311-
312-
if (!mount) {
313-
outputFilePath.sign(
314-
ApkUtils.SigningOptions(
315-
keystoreFilePath,
316-
keyStorePassword,
317-
alias,
318-
password,
319-
signer,
320-
),
321-
)
308+
apk.copyTo(temporaryFilesPath.resolve(apk.name), overwrite = true).apply {
309+
patcherResult.applyTo(this)
310+
}.let {
311+
if (!mount) {
312+
sign(
313+
it,
314+
outputFilePath,
315+
ApkUtils.SigningOptions(
316+
keystoreFilePath,
317+
keyStorePassword,
318+
alias,
319+
password,
320+
signer,
321+
),
322+
)
323+
}
322324
}
323325

324326
logger.info("Saved to $outputFilePath")

0 commit comments

Comments
 (0)