Skip to content

Commit 907d778

Browse files
Izder456GideonBear
andauthored
fix(openbsd): fix compilation on OpenBSD (#1473)
Co-authored-by: Gideon <[email protected]>
1 parent f3fccb8 commit 907d778

File tree

2 files changed

+7
-23
lines changed

2 files changed

+7
-23
lines changed

locales/app.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,14 +1306,6 @@ _version: 2
13061306
zh_CN: "Windows 更新"
13071307
zh_TW: "Windows 更新"
13081308
de: "Windows-Update"
1309-
"Checking if /etc/motd contains -current or -beta":
1310-
en: "Checking if /etc/motd contains -current or -beta"
1311-
lt: "Tikrinimas, jei /etc/motd yra -current arba -beta"
1312-
es: "Comprobación de si /etc/motd contiene -current o -beta"
1313-
fr: "Vérification si /etc/motd contient -current ou -beta"
1314-
zh_CN: "检查 /etc/motd 是否包含 -current 或 -beta"
1315-
zh_TW: "檢查 /etc/motd 是否包含 -current 或 -beta"
1316-
de: "Überprüfen, ob /etc/motd -current oder -beta enthält"
13171309
"Microsoft Store":
13181310
en: "Microsoft Store"
13191311
lt: "Microsoft parduotuvė"

src/steps/os/openbsd.rs

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
use crate::command::CommandExt;
22
use crate::execution_context::ExecutionContext;
3-
use crate::executor::RunType;
43
use crate::terminal::print_separator;
54
use color_eyre::eyre::Result;
65
use rust_i18n::t;
76
use std::fs;
7+
use tracing::debug;
88

9-
fn is_openbsd_current(ctx: &ExecutionContext) -> Result<bool> {
9+
fn is_openbsd_current() -> Result<bool> {
1010
let motd_content = fs::read_to_string("/etc/motd")?;
1111
let is_current = ["-current", "-beta"].iter().any(|&s| motd_content.contains(s));
12-
match ctx.config.run_type() {
13-
RunType::Dry | RunType::Damp => {
14-
println!("{}", t!("Checking if /etc/motd contains -current or -beta"));
15-
}
16-
RunType::Wet => {}
17-
}
12+
13+
debug!("OpenBSD is -current/-beta: {is_current}");
14+
1815
Ok(is_current)
1916
}
2017

@@ -23,12 +20,7 @@ pub fn upgrade_openbsd(ctx: &ExecutionContext) -> Result<()> {
2320

2421
let sudo = ctx.require_sudo()?;
2522

26-
let is_current = is_openbsd_current(ctx)?;
27-
28-
if ctx.config().dry_run() {
29-
println!("{}", t!("Would upgrade the OpenBSD system"));
30-
return Ok(());
31-
}
23+
let is_current = is_openbsd_current()?;
3224

3325
if is_current {
3426
sudo.execute(ctx, "/usr/sbin/sysupgrade")?.arg("-sn").status_checked()
@@ -42,7 +34,7 @@ pub fn upgrade_packages(ctx: &ExecutionContext) -> Result<()> {
4234

4335
let sudo = ctx.require_sudo()?;
4436

45-
let is_current = is_openbsd_current(ctx)?;
37+
let is_current = is_openbsd_current()?;
4638

4739
if ctx.config().cleanup() {
4840
sudo.execute(ctx, "/usr/sbin/pkg_delete")?.arg("-ac").status_checked()?;

0 commit comments

Comments
 (0)