Unify pacdiff and etc-update

This commit is contained in:
Roey Darwish Dror
2021-12-18 20:20:00 +02:00
parent 2c7dfb66c5
commit 3f12cf11f6
2 changed files with 14 additions and 14 deletions

View File

@@ -134,8 +134,8 @@ fn run() -> Result<()> {
println!("Error detecting current distribution: {}", e); println!("Error detecting current distribution: {}", e);
} }
} }
runner.execute(Step::System, "etc-update", || { runner.execute(Step::System, "config-update", || {
linux::run_etc_update(sudo.as_ref(), run_type) linux::run_config_update(sudo.as_ref(), run_type)
})?; })?;
runner.execute(Step::Pacdiff, "pacdiff", || linux::run_pacdiff(sudo.as_ref(), run_type))?; runner.execute(Step::Pacdiff, "pacdiff", || linux::run_pacdiff(sudo.as_ref(), run_type))?;

View File

@@ -535,22 +535,22 @@ pub fn run_pihole_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()
run_type.execute(sudo).arg(pihole).arg("-up").check_run() run_type.execute(sudo).arg(pihole).arg("-up").check_run()
} }
pub fn run_etc_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> { pub fn run_config_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
let sudo = require_option(sudo, String::from("sudo is not installed"))?; let sudo = require_option(sudo, String::from("sudo is not installed"))?;
let etc_update = require("etc-update")?;
print_separator("etc-update");
run_type.execute(sudo).arg(etc_update).check_run() if let Ok(etc_update) = require("etc-update") {
} print_separator("Configuration update");
run_type.execute(sudo).arg(etc_update).check_run()?;
} else if let Ok(pacdiff) = require("pacdiff") {
if std::env::var("DIFFPROG").is_err() {
require("vim")?;
}
pub fn run_pacdiff(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> { print_separator("Configuration update");
let sudo = require_option(sudo, String::from("sudo is not installed"))?; run_type.execute(sudo).arg(pacdiff).check_run()?;
let pacdiff = require("pacdiff")?; }
require("vim")?;
print_separator("pacdiff"); Ok(())
run_type.execute(sudo).arg(pacdiff).check_run()
} }
#[cfg(test)] #[cfg(test)]