Skip to content

Commit 846d77a

Browse files
committed
Create /run/reboot-required by default
When staging a new deployment, create /run/reboot-required to signal that a reboot is needed. This file is monitored by kured (Kubernetes Reboot Daemon) and other tools to detect when a system needs to be rebooted. This makes it easier to integrate bootc with kured and similar tools without requiring manual configuration or bridging.
1 parent 320fb5f commit 846d77a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

lib/src/deploy.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -737,12 +737,12 @@ pub(crate) async fn stage(
737737
})
738738
.await;
739739

740-
// Create /run/reboot-required to signal that a reboot is needed
741-
// This file is monitored by kured (Kubernetes Reboot Daemon)
740+
// Unconditionally create or update /run/reboot-required to signal a reboot is needed.
741+
// This is monitored by kured (Kubernetes Reboot Daemon).
742742
let run_dir = Dir::open_ambient_dir("/run", cap_std::ambient_authority())?;
743-
if !run_dir.try_exists("reboot-required")? {
744-
run_dir.atomic_write("reboot-required", b"").context("Creating /run/reboot-required")?;
745-
}
743+
run_dir
744+
.atomic_write("reboot-required", b"")
745+
.context("Creating /run/reboot-required")?;
746746

747747
Ok(())
748748
}

tmt/tests/booted/test-image-pushpull-upgrade.nu

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ RUN echo test content > /usr/share/blah.txt
6565
let progress = open --raw $progress_json | from json -o
6666
sanity_check_switch_progress_json $progress
6767

68+
# Check that /run/reboot-required exists and is a zero-byte file
69+
let rr_meta = ls /run/reboot-required
70+
assert equal $rr_meta.name "/run/reboot-required"
71+
assert equal $rr_meta.type "file"
72+
assert equal $rr_meta.size 0
73+
6874
# Also test that the mtime changes on modification
6975
let new_root_mtime = ls -Dl /ostree/bootc | get modified
7076
assert ($new_root_mtime > $orig_root_mtime)

0 commit comments

Comments
 (0)