1
0
mirror of https://github.com/containers/bootc.git synced 2026-02-05 06:45:13 +01:00

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.

Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
gursewak1997
2025-06-17 13:28:06 -07:00
committed by Colin Walters
parent c76d9e2c8e
commit 389f6f305d
2 changed files with 11 additions and 0 deletions

View File

@@ -737,6 +737,13 @@ pub(crate) async fn stage(
})
.await;
// Unconditionally create or update /run/reboot-required to signal a reboot is needed.
// This is monitored by kured (Kubernetes Reboot Daemon).
let run_dir = Dir::open_ambient_dir("/run", cap_std::ambient_authority())?;
run_dir
.atomic_write("reboot-required", b"")
.context("Creating /run/reboot-required")?;
Ok(())
}

View File

@@ -65,6 +65,10 @@ RUN echo test content > /usr/share/blah.txt
let progress = open --raw $progress_json | from json -o
sanity_check_switch_progress_json $progress
# Check that /run/reboot-required exists and is a zero-byte file
let rr_meta = (ls /run/reboot-required | first)
assert equal $rr_meta.size 0b
# Also test that the mtime changes on modification
let new_root_mtime = ls -Dl /ostree/bootc | get modified
assert ($new_root_mtime > $orig_root_mtime)