rust-bootupd/0001-grubconfigs-Ensure-grub2-dir-exists.patch
2023-11-10 08:18:35 -05:00

31 lines
947 B
Diff

From ece9120cb43b1834ff4b7268308886cd89a47e54 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Thu, 9 Nov 2023 19:17:57 -0500
Subject: [PATCH] grubconfigs: Ensure grub2 dir exists
I hit this when testing `bootc install` in a loop, it seems like
we could be implicitly depending on this directory already
having been created.
---
src/grubconfigs.rs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/grubconfigs.rs b/src/grubconfigs.rs
index 01f6b3e..dcdf986 100644
--- a/src/grubconfigs.rs
+++ b/src/grubconfigs.rs
@@ -62,6 +62,10 @@ pub(crate) fn install(target_root: &openat::Dir, efi: bool) -> Result<()> {
config.push_str(post.as_str());
}
+ if !bootdir.exists(GRUB2DIR)? {
+ bootdir.create_dir(GRUB2DIR, 0o700)?;
+ }
+
bootdir
.write_file_contents(format!("{GRUB2DIR}/grub.cfg"), 0o644, config.as_bytes())
.context("Copying grub-static.cfg")?;
--
2.41.0