committed by
GitHub
parent
d48182e6bd
commit
417ca1257a
@@ -455,13 +455,12 @@ fn upgrade_nixos(sudo: &Option<PathBuf>, cleanup: bool, run_type: RunType) -> Re
|
||||
}
|
||||
|
||||
pub fn run_needrestart(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||
let sudo = require_option(sudo)?;
|
||||
let sudo = require_option(sudo, String::from("sudo is not installed"))?;
|
||||
let needrestart = require("needrestart")?;
|
||||
let distribution = Distribution::detect()?;
|
||||
|
||||
if distribution.redhat_based() {
|
||||
debug!("Skipping needrestart on Redhat based distributions");
|
||||
return Err(SkipStep.into());
|
||||
return Err(SkipStep(String::from("needrestart will be ran by the package manager")).into());
|
||||
}
|
||||
|
||||
print_separator("Check for needed restarts");
|
||||
@@ -475,7 +474,7 @@ pub fn run_fwupdmgr(run_type: RunType) -> Result<()> {
|
||||
let fwupdmgr = require("fwupdmgr")?;
|
||||
|
||||
if is_wsl()? {
|
||||
return Err(SkipStep.into());
|
||||
return Err(SkipStep(String::from("Should not run in WSL")).into());
|
||||
}
|
||||
|
||||
print_separator("Firmware upgrades");
|
||||
@@ -508,11 +507,11 @@ pub fn flatpak_update(run_type: RunType) -> Result<()> {
|
||||
}
|
||||
|
||||
pub fn run_snap(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||
let sudo = require_option(sudo)?;
|
||||
let sudo = require_option(sudo, String::from("sudo is not installed"))?;
|
||||
let snap = require("snap")?;
|
||||
|
||||
if !PathBuf::from("/var/snapd.socket").exists() && !PathBuf::from("/run/snapd.socket").exists() {
|
||||
return Err(SkipStep.into());
|
||||
return Err(SkipStep(String::from("Snapd socket does not exist")).into());
|
||||
}
|
||||
print_separator("snap");
|
||||
|
||||
@@ -520,7 +519,7 @@ pub fn run_snap(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||
}
|
||||
|
||||
pub fn run_pihole_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||
let sudo = require_option(sudo)?;
|
||||
let sudo = require_option(sudo, String::from("sudo is not installed"))?;
|
||||
let pihole = require("pihole")?;
|
||||
Path::new("/opt/pihole/update.sh").require()?;
|
||||
|
||||
@@ -530,7 +529,7 @@ pub fn run_pihole_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()
|
||||
}
|
||||
|
||||
pub fn run_etc_update(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||
let sudo = require_option(sudo)?;
|
||||
let sudo = require_option(sudo, String::from("sudo is not installed"))?;
|
||||
let etc_update = require("etc-update")?;
|
||||
print_separator("etc-update");
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use crate::execution_context::ExecutionContext;
|
||||
use crate::executor::{CommandExt, RunType};
|
||||
use crate::terminal::{print_separator, prompt_yesno};
|
||||
use crate::{
|
||||
error::{SkipStep, TopgradeError},
|
||||
error::TopgradeError,
|
||||
utils::{require, PathExt},
|
||||
};
|
||||
use anyhow::Result;
|
||||
@@ -88,7 +88,7 @@ pub fn upgrade_macos(ctx: &ExecutionContext) -> Result<()> {
|
||||
if system_update_available()? {
|
||||
let answer = prompt_yesno("A system update is available. Do you wish to install it?")?;
|
||||
if !answer {
|
||||
return Err(SkipStep.into());
|
||||
return Ok(());
|
||||
}
|
||||
println!();
|
||||
} else {
|
||||
|
||||
@@ -56,8 +56,7 @@ pub fn run_nix(ctx: &ExecutionContext) -> Result<()> {
|
||||
use super::linux::Distribution;
|
||||
|
||||
if let Ok(Distribution::NixOS) = Distribution::detect() {
|
||||
debug!("Nix on NixOS must be upgraded via 'nixos-rebuild switch', skipping.");
|
||||
return Err(SkipStep.into());
|
||||
return Err(SkipStep(String::from("Nix on NixOS must be upgraded via nixos-rebuild switch")).into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ pub fn run_wsl_topgrade(ctx: &ExecutionContext) -> Result<()> {
|
||||
let topgrade = Command::new(&wsl)
|
||||
.args(&["which", "topgrade"])
|
||||
.check_output()
|
||||
.map_err(|_| SkipStep)?;
|
||||
.map_err(|_| SkipStep(String::from("Could not find Topgrade installed in WSL")))?;
|
||||
|
||||
let mut command = ctx.run_type().execute(&wsl);
|
||||
command
|
||||
|
||||
Reference in New Issue
Block a user