committed by
GitHub
parent
f58b2a0c20
commit
3e08fda765
@@ -87,7 +87,7 @@ impl Distribution {
|
||||
let cleanup = ctx.config().cleanup();
|
||||
|
||||
match self {
|
||||
Distribution::Arch => upgrade_arch_linux(&sudo, cleanup, run_type, yes, &ctx.config().yay_arguments()),
|
||||
Distribution::Arch => upgrade_arch_linux(ctx),
|
||||
Distribution::CentOS | Distribution::Fedora => upgrade_redhat(ctx),
|
||||
Distribution::ClearLinux => upgrade_clearlinux(&sudo, run_type),
|
||||
Distribution::Debian => upgrade_debian(&sudo, cleanup, run_type, yes),
|
||||
@@ -128,14 +128,12 @@ pub fn show_pacnew() {
|
||||
}
|
||||
}
|
||||
|
||||
fn upgrade_arch_linux(
|
||||
sudo: &Option<PathBuf>,
|
||||
cleanup: bool,
|
||||
run_type: RunType,
|
||||
yes: bool,
|
||||
yay_arguments: &str,
|
||||
) -> Result<()> {
|
||||
fn upgrade_arch_linux(ctx: &ExecutionContext) -> Result<()> {
|
||||
let pacman = which("powerpill").unwrap_or_else(|| PathBuf::from("/usr/bin/pacman"));
|
||||
let yes = ctx.config().yes();
|
||||
let sudo = ctx.sudo();
|
||||
let run_type = ctx.run_type();
|
||||
let cleanup = ctx.config().cleanup();
|
||||
|
||||
let path = {
|
||||
let mut path = OsString::from("/usr/bin:");
|
||||
@@ -158,7 +156,7 @@ fn upgrade_arch_linux(
|
||||
.arg("--pacman")
|
||||
.arg(&pacman)
|
||||
.arg("-Syu")
|
||||
.args(yay_arguments.split_whitespace())
|
||||
.args(ctx.config().yay_arguments().split_whitespace())
|
||||
.env("PATH", path);
|
||||
|
||||
if yes {
|
||||
@@ -174,6 +172,27 @@ fn upgrade_arch_linux(
|
||||
}
|
||||
command.check_run()?;
|
||||
}
|
||||
} else if let Some(trizen) = which("trizen") {
|
||||
let mut command = run_type.execute(&trizen);
|
||||
|
||||
command
|
||||
.arg("-Syu")
|
||||
.args(ctx.config().trizen_arguments().split_whitespace())
|
||||
.env("PATH", path);
|
||||
|
||||
if yes {
|
||||
command.arg("--noconfirm");
|
||||
}
|
||||
command.check_run()?;
|
||||
|
||||
if cleanup {
|
||||
let mut command = run_type.execute(&trizen);
|
||||
command.arg("-Sc");
|
||||
if yes {
|
||||
command.arg("--noconfirm");
|
||||
}
|
||||
command.check_run()?;
|
||||
}
|
||||
} else if let Some(sudo) = &sudo {
|
||||
let mut command = run_type.execute(&sudo);
|
||||
command.arg(&pacman).arg("-Syu").env("PATH", path);
|
||||
|
||||
Reference in New Issue
Block a user