From b4f2f01d73475b7416382001c4eff3e63543eb56 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Fri, 29 Dec 2023 15:16:56 +0100 Subject: [PATCH] Create symlinks before installing packages This allows redirecting the location packages are installed using symlinks. This makes it much easier to change the filesystem hierarchy by not having to change every recipe in the cookbook. --- src/config/file.rs | 2 +- src/lib.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config/file.rs b/src/config/file.rs index 80895134f1..21565c3659 100644 --- a/src/config/file.rs +++ b/src/config/file.rs @@ -46,7 +46,7 @@ pub struct FileConfig { // TODO: Rewrite impls impl FileConfig { - pub(crate) fn create>(self, prefix: P) -> Result<()> { + pub(crate) fn create>(&self, prefix: P) -> Result<()> { let path = self.path.trim_start_matches('/'); let target_file = prefix.as_ref() .join(path); diff --git a/src/lib.rs b/src/lib.rs index 78f2d61ad7..e990e9baf7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -172,12 +172,12 @@ pub fn install_dir, S: AsRef>(config: Config, output_dir: P, let output_dir = output_dir.to_owned(); - install_packages(&config, output_dir.to_str().unwrap(), cookbook); - - for file in config.files { + for file in &config.files { file.create(&output_dir)?; } + install_packages(&config, output_dir.to_str().unwrap(), cookbook); + let mut passwd = String::new(); let mut shadow = String::new(); let mut next_uid = 1000;