FIX: Allow for -beta OR -current detection and use the correct system upgrade command for the OpenBSD step (#1066)

* FIX: Allow for -beta OR -current detection and use the correct system upgrade command for the OpenBSD step

* FIX: Run fmt, clippy, and test
This commit is contained in:
Izzy Meyer
2025-03-12 20:02:45 -05:00
committed by GitHub
parent 722903fec3
commit 5770a5caa7

View File

@@ -8,7 +8,7 @@ use std::fs;
fn is_openbsd_current(ctx: &ExecutionContext) -> Result<bool> {
let motd_content = fs::read_to_string("/etc/motd")?;
let is_current = motd_content.contains("-current");
let is_current = ["-current", "-beta"].iter().any(|&s| motd_content.contains(s));
if ctx.config().dry_run() {
println!("{}", t!("Would check if OpenBSD is -current"));
Ok(is_current)
@@ -28,10 +28,11 @@ pub fn upgrade_openbsd(ctx: &ExecutionContext) -> Result<()> {
return Ok(());
}
let mut args = vec!["/usr/sbin/sysupgrade", "-n"];
if is_current {
args.push("-s");
}
let args = if is_current {
vec!["/usr/sbin/sysupgrade", "-sn"]
} else {
vec!["/usr/sbin/syspatch"]
};
ctx.run_type().execute(sudo).args(&args).status_checked()
}