Files
topgrade/src/steps/os/freebsd.rs

36 lines
1.1 KiB
Rust
Raw Normal View History

2022-11-13 07:25:07 -03:00
use crate::command::CommandExt;
2018-12-31 14:05:15 +02:00
use crate::executor::RunType;
2019-03-13 11:46:32 +02:00
use crate::terminal::print_separator;
use crate::utils::require_option;
2022-11-11 09:39:29 -05:00
use color_eyre::eyre::Result;
2018-11-12 11:13:43 +02:00
use std::path::PathBuf;
2018-11-15 11:37:08 +02:00
use std::process::Command;
2018-11-12 11:13:43 +02:00
pub fn upgrade_freebsd(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
2020-09-06 19:43:14 +03:00
let sudo = require_option(sudo, String::from("No sudo detected"))?;
2018-12-05 11:34:08 +02:00
print_separator("FreeBSD Update");
2019-03-10 21:48:49 +02:00
run_type
.execute(sudo)
2022-11-13 07:25:07 -03:00
.args(["/usr/sbin/freebsd-update", "fetch", "install"])
.status_checked()
2018-11-12 11:13:43 +02:00
}
pub fn upgrade_packages(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
2020-09-06 19:43:14 +03:00
let sudo = require_option(sudo, String::from("No sudo detected"))?;
2018-12-05 11:34:08 +02:00
print_separator("FreeBSD Packages");
run_type
.execute(sudo)
.args(["/usr/sbin/pkg", "upgrade"])
.status_checked()
2018-11-12 11:13:43 +02:00
}
2018-11-15 11:37:08 +02:00
pub fn audit_packages(sudo: &Option<PathBuf>) -> Result<()> {
2018-11-15 15:54:24 +02:00
if let Some(sudo) = sudo {
println!();
Command::new(sudo)
2022-11-13 07:25:07 -03:00
.args(["/usr/sbin/pkg", "audit", "-Fr"])
.status_checked()?;
2018-11-15 15:54:24 +02:00
}
2018-11-15 11:37:08 +02:00
Ok(())
}