use crate::utils::fs::hardcopy::hardcopy_handler; use crate::utils::shell::*; use crate::utils::parser::env::get_install_env; pub fn link(repo: &String, pkgname: &String) { let source = crate::commands::get_aeropkg_base().join(repo).join(pkgname); if source.join("disabled").exists() { println!("Disabled package, no linking: {}\nUse `pkg enable {}` to link", pkgname, pkgname); return } let destination = &crate::commands::get_aeropkg_base().join(repo); let dirs_to_copy = vec![ ("bin"), ("sbin"), ("lib"), ("libexec"), ("include"), ("share") ]; for base_system_folder_dir in dirs_to_copy { let src = source.join(base_system_folder_dir); let dest = destination.join(base_system_folder_dir); if src.exists() { hardcopy_handler(&src, &dest) .map_err(|e| format!("Failed to copy {} to {}: {}", src.display(), dest.display(), e)).unwrap() } } let builded_pkg_md_path = &crate::commands::get_aeropkg_base().join(repo).join(pkgname).join("build-script.md"); let full_env = get_install_env(repo, pkgname, builded_pkg_md_path, "link"); let mount_usr_dir_flag = full_env.get("mount_usr_dir").is_some(); if mount_usr_dir_flag { mount_overlay(); } shell_update() }