Skip to content

Commit 77c607a

Browse files
authored
Merge pull request #1592 from bshephar/reboot-file-fn
[Feature] Add function to write reboot-required
2 parents 4d5fc45 + 67008d5 commit 77c607a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

crates/lib/src/deploy.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,14 @@ pub(crate) async fn stage(
794794

795795
// Unconditionally create or update /run/reboot-required to signal a reboot is needed.
796796
// This is monitored by kured (Kubernetes Reboot Daemon).
797-
let reboot_message = format!("bootc: Reboot required for image: {}", &spec.image.image);
797+
write_reboot_required(&image.manifest_digest.as_ref())?;
798+
799+
Ok(())
800+
}
801+
802+
/// Update the /run/reboot-required file with the image that will be active after a reboot.
803+
fn write_reboot_required(image: &str) -> Result<()> {
804+
let reboot_message = format!("bootc: Reboot required for image: {}", image);
798805
let run_dir = Dir::open_ambient_dir("/run", cap_std::ambient_authority())?;
799806
run_dir
800807
.atomic_write("reboot-required", reboot_message.as_bytes())
@@ -870,6 +877,8 @@ pub(crate) async fn rollback(sysroot: &Storage) -> Result<()> {
870877
println!("Next boot: rollback deployment");
871878
}
872879

880+
write_reboot_required(rollback_image.manifest_digest.as_ref())?;
881+
873882
sysroot.update_mtime()?;
874883

875884
Ok(())

0 commit comments

Comments
 (0)