Move linux steps to the linux model
This commit is contained in:
72
src/steps.rs
72
src/steps.rs
@@ -1,5 +1,4 @@
|
||||
use super::terminal::Terminal;
|
||||
use super::{which, Check};
|
||||
use super::Check;
|
||||
use failure;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
@@ -143,75 +142,6 @@ pub fn run_homebrew(homebrew: &PathBuf) -> Result<(), failure::Error> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn upgrade_arch_linux(
|
||||
sudo: &Option<PathBuf>,
|
||||
terminal: &Terminal,
|
||||
) -> Result<(), failure::Error> {
|
||||
if let Ok(yay) = which("yay") {
|
||||
Command::new(yay).spawn()?.wait()?.check()?;
|
||||
} else {
|
||||
if let Some(sudo) = &sudo {
|
||||
Command::new(&sudo)
|
||||
.args(&["pacman", "-Syu"])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
} else {
|
||||
terminal.print_warning("No sudo or yay detected. Skipping system upgrade");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn upgrade_redhat(sudo: &Option<PathBuf>, terminal: &Terminal) -> Result<(), failure::Error> {
|
||||
if let Some(sudo) = &sudo {
|
||||
Command::new(&sudo)
|
||||
.args(&["yum", "upgrade"])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
} else {
|
||||
terminal.print_warning("No sudo detected. Skipping system upgrade");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn upgrade_fedora(sudo: &Option<PathBuf>, terminal: &Terminal) -> Result<(), failure::Error> {
|
||||
if let Some(sudo) = &sudo {
|
||||
Command::new(&sudo)
|
||||
.args(&["dnf", "upgrade"])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
} else {
|
||||
terminal.print_warning("No sudo detected. Skipping system upgrade");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn upgrade_debian(sudo: &Option<PathBuf>, terminal: &Terminal) -> Result<(), failure::Error> {
|
||||
if let Some(sudo) = &sudo {
|
||||
Command::new(&sudo)
|
||||
.args(&["apt", "update"])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
|
||||
Command::new(&sudo)
|
||||
.args(&["apt", "dist-upgrade"])
|
||||
.spawn()?
|
||||
.wait()?
|
||||
.check()?;
|
||||
} else {
|
||||
terminal.print_warning("No sudo detected. Skipping system upgrade");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_custom_command(command: &str) -> Result<(), failure::Error> {
|
||||
Command::new("sh")
|
||||
.arg("-c")
|
||||
|
||||
Reference in New Issue
Block a user