add option to pass key pwd from arg
This commit is contained in:
parent
c0152e7608
commit
acd5c8445e
2 changed files with 14 additions and 7 deletions
|
|
@ -150,6 +150,7 @@ impl FileInfo {
|
|||
///
|
||||
/// The `zipalign` and `apksigner` args allow to use a specific version of the
|
||||
/// tools instead of the one in the PATH (if it even exist)
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn replace_dex(
|
||||
apk: impl AsRef<Path>,
|
||||
dst: impl AsRef<Path>,
|
||||
|
|
@ -159,6 +160,7 @@ pub fn replace_dex(
|
|||
// 2048 -validity 10000 -alias ALIAS`
|
||||
zipalign: Option<impl AsRef<Path>>,
|
||||
apksigner: Option<impl AsRef<Path>>,
|
||||
keypassword: Option<&str>,
|
||||
additionnal_files: Option<HashMap<String, Option<impl Read + Seek>>>,
|
||||
) {
|
||||
let zipalign = if let Some(path) = &zipalign {
|
||||
|
|
@ -233,14 +235,19 @@ pub fn replace_dex(
|
|||
.status()
|
||||
.unwrap();
|
||||
|
||||
Command::new(apksigner)
|
||||
let mut cmd = Command::new(apksigner);
|
||||
let cmd = cmd
|
||||
.arg("sign")
|
||||
.arg("--ks")
|
||||
.arg(keystore.as_ref().as_os_str())
|
||||
.arg("--out")
|
||||
.arg(dst.as_ref().as_os_str())
|
||||
.arg(aligned_path.as_os_str())
|
||||
.status()
|
||||
.unwrap();
|
||||
.arg(aligned_path.as_os_str());
|
||||
let cmd = if let Some(pwd) = keypassword {
|
||||
cmd.arg("--ks-pass").arg(format!("pass:${pwd}"))
|
||||
} else {
|
||||
cmd
|
||||
};
|
||||
cmd.status().unwrap();
|
||||
fs::remove_dir_all(tmp_dir).expect("Failled to remove tmp dir");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue