2022-11-02 11:00:10 +01:00
|
|
|
use crate::executor::RunType;
|
|
|
|
|
use crate::terminal::print_separator;
|
|
|
|
|
use crate::utils::require_option;
|
2022-11-23 15:23:00 +00:00
|
|
|
use anyhow::Result;
|
2022-11-02 11:00:10 +01:00
|
|
|
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");
|
2022-11-08 05:54:35 -05:00
|
|
|
run_type
|
|
|
|
|
.execute(sudo)
|
|
|
|
|
.args(&["/usr/sbin/sysupgrade", "-n"])
|
|
|
|
|
.status_checked()
|
2022-11-02 11:00:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
2022-11-08 05:54:35 -05:00
|
|
|
run_type
|
|
|
|
|
.execute(sudo)
|
|
|
|
|
.args(&["/usr/sbin/pkg_add", "-u"])
|
|
|
|
|
.status_checked()
|
2022-11-02 11:00:10 +01:00
|
|
|
}
|