Selective yes (fix #802) (#808)

* Selective yes flag (fix #802)

* Selective yes flag (fix #802)

* selective yes

* MacOS
This commit is contained in:
Roey Darwish Dror
2021-12-06 14:44:20 +02:00
committed by GitHub
parent 4b8cf641a1
commit ab3ff0ecae
11 changed files with 77 additions and 59 deletions

View File

@@ -4,6 +4,7 @@ use crate::executor::{CommandExt, RunType};
use crate::steps::os::archlinux;
use crate::terminal::{print_separator, print_warning};
use crate::utils::{require, require_option, which, PathExt};
use crate::Step;
use anyhow::Result;
use ini::Ini;
use log::debug;
@@ -137,7 +138,7 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
if ctx.config().rpm_ostree() {
let mut command = ctx.run_type().execute(ostree);
command.arg("upgrade");
if ctx.config().yes() {
if ctx.config().yes(Step::System) {
command.arg("-y");
}
@@ -163,7 +164,7 @@ fn upgrade_redhat(ctx: &ExecutionContext) -> Result<()> {
command.args(args.split_whitespace());
}
if ctx.config().yes() {
if ctx.config().yes(Step::System) {
command.arg("-y");
}
@@ -259,7 +260,7 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
let mut command = ctx.run_type().execute(&sudo);
command.arg(&apt).arg("dist-upgrade");
if ctx.config().yes() {
if ctx.config().yes(Step::System) {
command.arg("-y");
}
if let Some(args) = ctx.config().apt_arguments() {
@@ -272,7 +273,7 @@ fn upgrade_debian(ctx: &ExecutionContext) -> Result<()> {
let mut command = ctx.run_type().execute(&sudo);
command.arg(&apt).arg("autoremove");
if ctx.config().yes() {
if ctx.config().yes(Step::System) {
command.arg("-y");
}
command.check_run()?;
@@ -391,7 +392,7 @@ fn upgrade_neon(ctx: &ExecutionContext) -> Result<()> {
ctx.run_type().execute(&sudo).arg(&pkcon).arg("refresh").check_run()?;
let mut exe = ctx.run_type().execute(&sudo);
let cmd = exe.arg(&pkcon).arg("update");
if ctx.config().yes() {
if ctx.config().yes(Step::System) {
cmd.arg("-y");
}
if ctx.config().cleanup() {
@@ -438,7 +439,7 @@ pub fn run_fwupdmgr(ctx: &ExecutionContext) -> Result<()> {
if ctx.config().firmware_upgrade() {
updmgr.arg("update");
if ctx.config().yes() {
if ctx.config().yes(Step::System) {
updmgr.arg("-y");
}
} else {