Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at github-to-sqlite-beautifulsoup4 34 lines 1.2 kB view raw
1diff --git a/src/portable/install.rs b/src/portable/install.rs 2index dc0d932..5394fc1 100644 3--- a/src/portable/install.rs 4+++ b/src/portable/install.rs 5@@ -133,8 +133,16 @@ fn unpack_package(cache_file: &Path, target_dir: &Path) 6 for entry in arch.entries()? { 7 let mut entry = entry?; 8 let path = entry.path()?; 9+ let is_inside_bin = { 10+ let mut path_iter = path.iter(); 11+ path_iter.next(); // discards first folder 12+ path_iter.as_path().starts_with("bin") 13+ }; 14 if let Some(path) = build_path(&target_dir, &*path)? { 15- entry.unpack(path)?; 16+ entry.unpack(&path)?; 17+ if is_inside_bin { 18+ nix_patchelf_if_needed(&path); 19+ } 20 } 21 } 22 bar.finish_and_clear(); 23@@ -203,3 +211,11 @@ pub fn package(pkg_info: &PackageInfo) -> anyhow::Result<InstallInfo> { 24 25 Ok(info) 26 } 27+ 28+fn nix_patchelf_if_needed(dest_path: &Path) { 29+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf") 30+ .arg("--set-interpreter") 31+ .arg("@dynamicLinker@") 32+ .arg(dest_path) 33+ .output(); 34+}