feat: add assume-yes to more Linux managers (#501)
* Add assume-yes options to most Linux managers Add `assume-yes` to : - SUSE (Micro) - TW (`zypper`) - PCLinux OS (`apt`) - Solus (`eopkg`) - `pacdef` - Clear Linux (`swupd`)
This commit is contained in:
@@ -256,6 +256,7 @@ fn upgrade_suse(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
} else {
|
} else {
|
||||||
"update"
|
"update"
|
||||||
})
|
})
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -272,6 +273,7 @@ fn upgrade_opensuse_tumbleweed(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.arg("zypper")
|
.arg("zypper")
|
||||||
.arg("dist-upgrade")
|
.arg("dist-upgrade")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -281,7 +283,9 @@ fn upgrade_suse_micro(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.args(["transactional-update", "dup"])
|
.arg("transactional-update")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-n" } else { "" })
|
||||||
|
.arg("dup")
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -325,6 +329,7 @@ fn upgrade_pclinuxos(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.arg(&which("apt-get").unwrap())
|
.arg(&which("apt-get").unwrap())
|
||||||
.arg("dist-upgrade")
|
.arg("dist-upgrade")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -499,7 +504,9 @@ fn upgrade_solus(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
let sudo = require_option(ctx.sudo().as_ref(), REQUIRE_SUDO.to_string())?;
|
||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.args(["eopkg", "upgrade"])
|
.arg("eopkg")
|
||||||
|
.arg(if ctx.config().yes(Step::System) { "-y" } else { "" })
|
||||||
|
.arg("upgrade")
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -542,6 +549,11 @@ pub fn run_pacdef(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(&pacdef)
|
.execute(&pacdef)
|
||||||
.args(["package", "sync"])
|
.args(["package", "sync"])
|
||||||
|
.arg(if ctx.config().yes(Step::System) {
|
||||||
|
"--noconfirm"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
})
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
@@ -550,7 +562,15 @@ pub fn run_pacdef(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
.args(["package", "review"])
|
.args(["package", "review"])
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
} else {
|
} else {
|
||||||
ctx.run_type().execute(&pacdef).arg("sync").status_checked()?;
|
ctx.run_type()
|
||||||
|
.execute(&pacdef)
|
||||||
|
.arg("sync")
|
||||||
|
.arg(if ctx.config().yes(Step::System) {
|
||||||
|
"--noconfirm"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
})
|
||||||
|
.status_checked()?;
|
||||||
|
|
||||||
println!();
|
println!();
|
||||||
ctx.run_type().execute(&pacdef).arg("review").status_checked()?;
|
ctx.run_type().execute(&pacdef).arg("review").status_checked()?;
|
||||||
@@ -599,6 +619,11 @@ fn upgrade_clearlinux(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
ctx.run_type()
|
ctx.run_type()
|
||||||
.execute(sudo)
|
.execute(sudo)
|
||||||
.args(["swupd", "update"])
|
.args(["swupd", "update"])
|
||||||
|
.arg(if ctx.config().yes(Step::System) {
|
||||||
|
"--assume=yes"
|
||||||
|
} else {
|
||||||
|
""
|
||||||
|
})
|
||||||
.status_checked()?;
|
.status_checked()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user