Handle Symbolic containers properly

This commit is contained in:
Xavier Moffett 2024-05-27 18:08:36 -04:00
parent 2dd3f1dbf1
commit 21b4fa6c32
Signed by: Sapphirus
GPG key ID: A6C061B2CEA1A7AC
5 changed files with 27 additions and 25 deletions

View file

@ -19,6 +19,7 @@
use std::{
fmt::{Display, Formatter, Result as FmtResult},
fs::{create_dir, create_dir_all},
os::unix::fs::symlink,
path::Path,
process::exit,
};
@ -189,7 +190,14 @@ pub fn instantiate_container<'a>(handle: &'a ContainerHandle<'a>) -> Result<()>
let root = handle.vars().root();
let home = handle.vars().home();
create_dir(root).prepend_io(|| root.into())?;
if let ContainerType::Symbolic = instype {
let dep = handle.metadata().dependencies();
let dep = dep.last().expect("Dependency element");
symlink(dep, root).prepend_io(|| root.into())?;
} else {
create_dir(root).prepend_io(|| root.into())?;
}
if let ContainerType::Aggregate | ContainerType::Base = instype {
if !Path::new(home).exists() {