Skip to content

Commit

Permalink
grubconfigs: Ensure grub2 dir exists
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cgwalters committed Nov 10, 2023
1 parent 03e73b9 commit ece9120
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/grubconfigs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")?;
Expand Down

0 comments on commit ece9120

Please sign in to comment.