Files
AeroPkg/src/commands/link.rs

32 lines
976 B
Rust
Raw Normal View History

2025-11-18 19:46:36 +03:00
use crate::utils::fs::hardcopy::hardcopy_handler;
2025-08-08 00:00:14 +03:00
use crate::utils::shell::*;
pub fn link(repo: &String, pkgname: &String) {
2025-11-18 19:46:36 +03:00
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 }
2025-08-08 00:00:14 +03:00
2026-07-22 04:29:56 +03:00
let destination = &crate::commands::get_aeropkg_base().join(repo);
2025-08-08 00:00:14 +03:00
let dirs_to_copy = vec![
("bin"),
2025-11-18 19:46:36 +03:00
("sbin"),
2025-08-08 00:00:14 +03:00
("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()
2025-08-08 00:00:14 +03:00
}
}
mount_overlay();
shell_update()
2025-08-08 00:00:14 +03:00
}