Skip to content

Commit

Permalink
Merge pull request #54 from OSInside/copy_links_for_host_deps
Browse files Browse the repository at this point in the history
Copy symlinks for host dependencies
  • Loading branch information
schaefi authored Dec 12, 2024
2 parents 3c06583 + bc6ca4b commit cffac96
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions podman-pilot/src/podman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ fn run_podman_creation(

// lookup and sync host dependencies from systemfiles data
let mut ignore_missing = false;
let mut copy_links = true;
let system_files = tempfile()?;
if let Ok(systemfiles) = has_system_dependencies(
&instance_mount_point, &system_files
Expand All @@ -329,7 +330,8 @@ fn run_podman_creation(
}
match sync_host(
&instance_mount_point, &system_files,
root_user, ignore_missing, defaults::SYSTEM_HOST_DEPENDENCIES
root_user, ignore_missing, copy_links,
defaults::SYSTEM_HOST_DEPENDENCIES
) {
Ok(_) => { },
Err(error) => {
Expand All @@ -344,11 +346,13 @@ fn run_podman_creation(
// lookup and sync host dependencies from removed data
if provisioning_failed.is_none() {
ignore_missing = true;
copy_links = false;
let removed_files = tempfile()?;
update_removed_files(&instance_mount_point, &removed_files)?;
sync_host(
&instance_mount_point, &removed_files,
root_user, ignore_missing, defaults::HOST_DEPENDENCIES
root_user, ignore_missing, copy_links,
defaults::HOST_DEPENDENCIES
)?;
}

Expand Down Expand Up @@ -390,7 +394,8 @@ fn run_podman_creation(
}
sync_host(
&instance_mount_point, &removed_files,
root_user, ignore_missing, defaults::HOST_DEPENDENCIES
root_user, ignore_missing, copy_links,
defaults::HOST_DEPENDENCIES
)?;
}

Expand Down Expand Up @@ -566,7 +571,7 @@ pub fn umount_container(

pub fn sync_host(
target: &String, mut removed_files: &File, user: User,
ignore_missing: bool, from: &str
ignore_missing: bool, copy_links: bool, from: &str
) -> Result<(), FlakeError> {
/*!
Sync files/dirs specified in target/from, from the running
Expand All @@ -588,6 +593,9 @@ pub fn sync_host(

let mut call = user.run("rsync");
call.arg("-av");
if copy_links {
call.arg("--copy-links");
}
if ignore_missing {
call.arg("--ignore-missing-args");
}
Expand Down

0 comments on commit cffac96

Please sign in to comment.