Skip to content

Commit

Permalink
Merge pull request containers#715 from travier/main-systemctl-reset
Browse files Browse the repository at this point in the history
bootupctl: Clear failure status from previous runs
  • Loading branch information
HuijingHei authored Sep 3, 2024
2 parents 9bc21ba + 6fcc010 commit 0f3de09
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cli/bootupctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use clap::Parser;
use log::LevelFilter;

use std::os::unix::process::CommandExt;
use std::process::Command;
use std::process::{Command, Stdio};

static SYSTEMD_ARGS_BOOTUPD: &[&str] = &[
"--unit",
Expand Down Expand Up @@ -154,6 +154,14 @@ fn ensure_running_in_systemd() -> Result<()> {
require_root_permission()?;
let running_in_systemd = running_in_systemd();
if !running_in_systemd {
// Clear any failure status that may have happened previously
let _r = Command::new("systemctl")
.arg("reset-failed")
.arg("bootupd.service")
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()?
.wait()?;
let r = Command::new("systemd-run")
.args(SYSTEMD_ARGS_BOOTUPD)
.args(std::env::args())
Expand Down

0 comments on commit 0f3de09

Please sign in to comment.