2022-07-14 12:49:19 +00:00
|
|
|
diff --git a/src/portable/install.rs b/src/portable/install.rs
|
2024-06-05 15:53:02 +00:00
|
|
|
index 15944e4..f873349 100644
|
2022-07-14 12:49:19 +00:00
|
|
|
--- a/src/portable/install.rs
|
|
|
|
+++ b/src/portable/install.rs
|
2024-06-05 15:53:02 +00:00
|
|
|
@@ -134,8 +134,16 @@ fn unpack_package(cache_file: &Path, target_dir: &Path) -> anyhow::Result<()> {
|
2022-07-14 12:49:19 +00:00
|
|
|
for entry in arch.entries()? {
|
|
|
|
let mut entry = entry?;
|
|
|
|
let path = entry.path()?;
|
|
|
|
+ let is_inside_bin = {
|
|
|
|
+ let mut path_iter = path.iter();
|
|
|
|
+ path_iter.next(); // discards first folder
|
|
|
|
+ path_iter.as_path().starts_with("bin")
|
|
|
|
+ };
|
2024-06-05 15:53:02 +00:00
|
|
|
if let Some(path) = build_path(&target_dir, &path)? {
|
2022-07-14 12:49:19 +00:00
|
|
|
- entry.unpack(path)?;
|
|
|
|
+ entry.unpack(&path)?;
|
|
|
|
+ if is_inside_bin {
|
|
|
|
+ nix_patchelf_if_needed(&path);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
bar.finish_and_clear();
|
2024-06-05 15:53:02 +00:00
|
|
|
@@ -222,3 +230,11 @@ pub fn package(pkg_info: &PackageInfo) -> anyhow::Result<InstallInfo> {
|
2022-07-14 12:49:19 +00:00
|
|
|
|
|
|
|
Ok(info)
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+fn nix_patchelf_if_needed(dest_path: &Path) {
|
|
|
|
+ let _ = ::std::process::Command::new("@patchelf@/bin/patchelf")
|
|
|
|
+ .arg("--set-interpreter")
|
|
|
|
+ .arg("@dynamicLinker@")
|
|
|
|
+ .arg(dest_path)
|
|
|
|
+ .output();
|
|
|
|
+}
|