OpenBSD support (#104)
This commit is contained in:
10
src/main.rs
10
src/main.rs
@@ -209,6 +209,11 @@ fn run() -> Result<()> {
|
|||||||
freebsd::upgrade_packages(sudo.as_ref(), run_type)
|
freebsd::upgrade_packages(sudo.as_ref(), run_type)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
#[cfg(target_os = "openbsd")]
|
||||||
|
runner.execute(Step::Pkg, "OpenBSD Packages", || {
|
||||||
|
openbsd::upgrade_packages(sudo.as_ref(), run_type)
|
||||||
|
})?;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
runner.execute(Step::Pkg, "Termux Packages", || android::upgrade_packages(&ctx))?;
|
runner.execute(Step::Pkg, "Termux Packages", || android::upgrade_packages(&ctx))?;
|
||||||
|
|
||||||
@@ -411,6 +416,11 @@ fn run() -> Result<()> {
|
|||||||
freebsd::upgrade_freebsd(sudo.as_ref(), run_type)
|
freebsd::upgrade_freebsd(sudo.as_ref(), run_type)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
#[cfg(target_os = "openbsd")]
|
||||||
|
runner.execute(Step::System, "OpenBSD Upgrade", || {
|
||||||
|
openbsd::upgrade_openbsd(sudo.as_ref(), run_type)
|
||||||
|
})?;
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
runner.execute(Step::System, "Windows update", || windows::windows_update(&ctx))?;
|
runner.execute(Step::System, "Windows update", || windows::windows_update(&ctx))?;
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ pub mod freebsd;
|
|||||||
pub mod linux;
|
pub mod linux;
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
pub mod macos;
|
pub mod macos;
|
||||||
|
#[cfg(target_os = "openbsd")]
|
||||||
|
pub mod openbsd;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub mod unix;
|
pub mod unix;
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
|
|||||||
17
src/steps/os/openbsd.rs
Normal file
17
src/steps/os/openbsd.rs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
use crate::executor::RunType;
|
||||||
|
use crate::terminal::print_separator;
|
||||||
|
use crate::utils::require_option;
|
||||||
|
use anyhow::Result;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
pub fn upgrade_openbsd(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||||
|
let sudo = require_option(sudo, String::from("No sudo detected"))?;
|
||||||
|
print_separator("OpenBSD Update");
|
||||||
|
run_type.execute(sudo).args(&["/usr/sbin/sysupgrade", "-n"]).check_run()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn upgrade_packages(sudo: Option<&PathBuf>, run_type: RunType) -> Result<()> {
|
||||||
|
let sudo = require_option(sudo, String::from("No sudo detected"))?;
|
||||||
|
print_separator("OpenBSD Packages");
|
||||||
|
run_type.execute(sudo).args(&["/usr/sbin/pkg_add", "-u"]).check_run()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user