diff --git a/src/grubconfigs.rs b/src/grubconfigs.rs index 8b4b0c90..dbf48699 100644 --- a/src/grubconfigs.rs +++ b/src/grubconfigs.rs @@ -38,6 +38,10 @@ pub(crate) fn install(target_root: &openat::Dir, efi: bool, write_uuid: bool) -> root_dev != boot_dev }; + if !bootdir.exists(GRUB2DIR)? { + bootdir.create_dir(GRUB2DIR, 0o700)?; + } + let mut config = std::fs::read_to_string(Path::new(CONFIGDIR).join("grub-static-pre.cfg"))?; let dropindir = openat::Dir::open(&Path::new(CONFIGDIR).join(DROPINDIR))?; @@ -68,10 +72,6 @@ pub(crate) fn install(target_root: &openat::Dir, efi: bool, write_uuid: bool) -> 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")?;