Merge branch 'dev' into master

This commit is contained in:
Thomas Schönauer
2022-10-14 17:37:11 +02:00
committed by GitHub
15 changed files with 328 additions and 61 deletions

View File

@@ -349,6 +349,17 @@ fn upgrade_solus(ctx: &ExecutionContext) -> Result<()> {
Ok(())
}
pub fn run_pacdef(ctx: &ExecutionContext) -> Result<()> {
let pacdef = require("pacdef")?;
print_separator("pacdef");
ctx.run_type().execute(&pacdef).arg("sync").check_run()?;
println!();
ctx.run_type().execute(&pacdef).arg("review").check_run()
}
pub fn run_pacstall(ctx: &ExecutionContext) -> Result<()> {
let pacstall = require("pacstall")?;
@@ -492,44 +503,50 @@ pub fn flatpak_update(ctx: &ExecutionContext) -> Result<()> {
let flatpak = require("flatpak")?;
let sudo = require_option(ctx.sudo().as_ref(), String::from("sudo is not installed"))?;
let cleanup = ctx.config().cleanup();
let yes = ctx.config().yes(Step::Flatpak);
let run_type = ctx.run_type();
print_separator("Flatpak User Packages");
run_type
.execute(&flatpak)
.args(&["update", "--user", "-y"])
.check_run()?;
let mut update_args = vec!["update", "--user"];
if yes {
update_args.push("-y");
}
run_type.execute(&flatpak).args(&update_args).check_run()?;
if cleanup {
run_type
.execute(&flatpak)
.args(&["uninstall", "--user", "--unused"])
.check_run()?;
let mut cleanup_args = vec!["uninstall", "--user", "--unused"];
if yes {
cleanup_args.push("-y");
}
run_type.execute(&flatpak).args(&cleanup_args).check_run()?;
}
print_separator("Flatpak System Packages");
if ctx.config().flatpak_use_sudo() || std::env::var("SSH_CLIENT").is_ok() {
run_type
.execute(&sudo)
.arg(&flatpak)
.args(&["update", "--system", "-y"])
.check_run()?;
let mut update_args = vec!["update", "--system"];
if yes {
update_args.push("-y");
}
run_type.execute(&sudo).arg(&flatpak).args(&update_args).check_run()?;
if cleanup {
run_type
.execute(sudo)
.arg(flatpak)
.args(&["uninstall", "--system", "--unused"])
.check_run()?;
let mut cleanup_args = vec!["uninstall", "--system", "--unused"];
if yes {
cleanup_args.push("-y");
}
run_type.execute(sudo).arg(flatpak).args(&cleanup_args).check_run()?;
}
} else {
run_type
.execute(&flatpak)
.args(&["update", "--system", "-y"])
.check_run()?;
let mut update_args = vec!["update", "--system"];
if yes {
update_args.push("-y");
}
run_type.execute(&flatpak).args(&update_args).check_run()?;
if cleanup {
run_type
.execute(flatpak)
.args(&["uninstall", "--system", "--unused"])
.check_run()?;
let mut cleanup_args = vec!["uninstall", "--system", "--unused"];
if yes {
cleanup_args.push("-y");
}
run_type.execute(flatpak).args(&cleanup_args).check_run()?;
}
}
@@ -558,6 +575,15 @@ pub fn run_pihole_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()
run_type.execute(sudo).arg(pihole).arg("-up").check_run()
}
pub fn run_protonup_update(ctx: &ExecutionContext) -> Result<()> {
let protonup = require("protonup")?;
print_separator("protonup");
ctx.run_type().execute(protonup).check_run()?;
Ok(())
}
pub fn run_config_update(ctx: &ExecutionContext) -> Result<()> {
let sudo = require_option(ctx.sudo().as_ref(), String::from("sudo is not installed"))?;
if ctx.config().yes(Step::ConfigUpdate) {

View File

@@ -210,6 +210,10 @@ pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<
variant.execute(run_type).arg("cleanup").check_run()?;
}
if ctx.config().brew_autoremove() {
variant.execute(run_type).arg("autoremove").check_run()?;
}
Ok(())
}
@@ -251,6 +255,24 @@ pub fn run_brew_cask(ctx: &ExecutionContext, variant: BrewVariant) -> Result<()>
Ok(())
}
pub fn run_guix(ctx: &ExecutionContext) -> Result<()> {
let guix = require("guix")?;
let run_type = ctx.run_type();
let output = Command::new(&guix).arg("pull").check_output();
debug!("guix pull output: {:?}", output);
let should_upgrade = output.is_ok();
debug!("Can Upgrade Guix: {:?}", should_upgrade);
print_separator("Guix");
if should_upgrade {
return run_type.execute(&guix).args(&["package", "-u"]).check_run();
}
Err(SkipStep(String::from("Guix Pull Failed, Skipping")).into())
}
pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
let nix = require("nix")?;
let nix_channel = require("nix-channel")?;
@@ -274,6 +296,16 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
}
}
#[cfg(target_os = "macos")]
{
if let Ok(..) = require("darwin-rebuild") {
return Err(SkipStep(String::from(
"Nix-darwin on macOS must be upgraded via darwin-rebuild switch",
))
.into());
}
}
let run_type = ctx.run_type();
if should_self_upgrade {
@@ -391,6 +423,14 @@ pub fn run_sdkman(base_dirs: &BaseDirs, cleanup: bool, run_type: RunType) -> Res
Ok(())
}
pub fn run_bun(ctx: &ExecutionContext) -> Result<()> {
let bun = require("bun")?;
print_separator("Bun");
ctx.run_type().execute(&bun).arg("upgrade").check_run()
}
pub fn reboot() {
print!("Rebooting...");
Command::new("sudo").arg("reboot").spawn().unwrap().wait().unwrap();