Skip to content

Commit

Permalink
Merge pull request #583 from dustymabe/dusty-grubconfigs
Browse files Browse the repository at this point in the history
grubconfigs: move the GRUB2DIR creation earlier
  • Loading branch information
cgwalters authored Dec 11, 2023
2 parents 4e2eb8a + baccac3 commit a5388f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/grubconfigs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))?;
Expand Down Expand Up @@ -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")?;
Expand Down

0 comments on commit a5388f6

Please sign in to comment.