mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-11-19 01:59:25 +01:00
fix: Do not sign if mounting
This commit is contained in:
parent
1319ab7629
commit
578e16b099
@ -208,16 +208,17 @@ internal object PatchCommand : Runnable {
|
|||||||
|
|
||||||
// region Save
|
// region Save
|
||||||
|
|
||||||
ApkUtils.alignAndSign(
|
val aligned = resourceCachePath.resolve(apk.name)
|
||||||
apk,
|
ApkUtils.align(apk, aligned, patcherResult)
|
||||||
|
if (!mount) ApkUtils.sign(
|
||||||
|
aligned,
|
||||||
outputFilePath,
|
outputFilePath,
|
||||||
SigningOptions(
|
SigningOptions(
|
||||||
commonName,
|
commonName,
|
||||||
password,
|
password,
|
||||||
keystoreFilePath ?: outputFilePath.parentFile
|
keystoreFilePath ?: outputFilePath.absoluteFile.parentFile
|
||||||
.resolve("${outputFilePath.nameWithoutExtension}.keystore"),
|
.resolve("${outputFilePath.nameWithoutExtension}.keystore"),
|
||||||
),
|
)
|
||||||
patcherResult
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
public final class app/revanced/lib/ApkUtils {
|
public final class app/revanced/lib/ApkUtils {
|
||||||
public static final field INSTANCE Lapp/revanced/lib/ApkUtils;
|
public static final field INSTANCE Lapp/revanced/lib/ApkUtils;
|
||||||
public final fun alignAndSign (Ljava/io/File;Ljava/io/File;Lapp/revanced/lib/signing/SigningOptions;Lapp/revanced/patcher/PatcherResult;)V
|
public final fun align (Ljava/io/File;Ljava/io/File;Lapp/revanced/patcher/PatcherResult;)V
|
||||||
|
public final fun sign (Ljava/io/File;Ljava/io/File;Lapp/revanced/lib/signing/SigningOptions;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/lib/Options {
|
public final class app/revanced/lib/Options {
|
||||||
|
@ -9,29 +9,10 @@ import app.revanced.patcher.PatcherResult
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
|
@Suppress("MemberVisibilityCanBePrivate", "unused")
|
||||||
object ApkUtils {
|
object ApkUtils {
|
||||||
private val logger = Logger.getLogger(ApkUtils::class.java.name)
|
private val logger = Logger.getLogger(ApkUtils::class.java.name)
|
||||||
|
|
||||||
/**
|
|
||||||
* Aligns and signs the apk at [apkFile] and writes it to [outputFile].
|
|
||||||
*
|
|
||||||
* @param apkFile The apk to align and sign.
|
|
||||||
* @param outputFile The apk to write the aligned and signed apk to.
|
|
||||||
* @param signingOptions The options to use for signing.
|
|
||||||
* @param patchedEntriesSource The result of the patcher to add the patched dex files and resources.
|
|
||||||
*/
|
|
||||||
fun alignAndSign(
|
|
||||||
apkFile: File,
|
|
||||||
outputFile: File,
|
|
||||||
signingOptions: SigningOptions,
|
|
||||||
patchedEntriesSource: PatcherResult
|
|
||||||
) {
|
|
||||||
if (outputFile.exists()) outputFile.delete()
|
|
||||||
|
|
||||||
align(apkFile, outputFile, patchedEntriesSource)
|
|
||||||
sign(outputFile, outputFile, signingOptions)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new apk from [apkFile] and [patchedEntriesSource] and writes it to [outputFile].
|
* Creates a new apk from [apkFile] and [patchedEntriesSource] and writes it to [outputFile].
|
||||||
*
|
*
|
||||||
@ -39,7 +20,7 @@ object ApkUtils {
|
|||||||
* @param outputFile The apk to write the new entries to.
|
* @param outputFile The apk to write the new entries to.
|
||||||
* @param patchedEntriesSource The result of the patcher to add the patched dex files and resources.
|
* @param patchedEntriesSource The result of the patcher to add the patched dex files and resources.
|
||||||
*/
|
*/
|
||||||
private fun align(apkFile: File, outputFile: File, patchedEntriesSource: PatcherResult) {
|
fun align(apkFile: File, outputFile: File, patchedEntriesSource: PatcherResult) {
|
||||||
logger.info("Aligning ${apkFile.name}")
|
logger.info("Aligning ${apkFile.name}")
|
||||||
|
|
||||||
ZipFile(outputFile).use { file ->
|
ZipFile(outputFile).use { file ->
|
||||||
@ -72,7 +53,7 @@ object ApkUtils {
|
|||||||
* @param output The apk to write the signed apk to.
|
* @param output The apk to write the signed apk to.
|
||||||
* @param signingOptions The options to use for signing.
|
* @param signingOptions The options to use for signing.
|
||||||
*/
|
*/
|
||||||
private fun sign(
|
fun sign(
|
||||||
apk: File,
|
apk: File,
|
||||||
output: File,
|
output: File,
|
||||||
signingOptions: SigningOptions,
|
signingOptions: SigningOptions,
|
||||||
|
Loading…
Reference in New Issue
Block a user