summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorDavHau <hsngrmpf+github@gmail.com>2020-11-07 18:08:48 +0700
committerDavHau <hsngrmpf+github@gmail.com>2020-11-07 18:08:48 +0700
commit05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76 (patch)
tree779d2827da24f2e660c47a28f7cb0e8970ec604f /pkgs/build-support/setup-hooks
parent112f275f4db95ef465ea4d24c0be2a2ca0b3decc (diff)
downloadnixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.tar
nixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.tar.gz
nixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.tar.bz2
nixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.tar.lz
nixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.tar.xz
nixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.tar.zst
nixpkgs-05fa0f1a2ec5ad455e16a72bdb304f7c0e098b76.zip
improve things shellcheck complains about
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/auto-patchelf.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh
index f51f016c334..49e84f84ceb 100644
--- a/pkgs/build-support/setup-hooks/auto-patchelf.sh
+++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh
@@ -57,7 +57,6 @@ populateCacheWithRecursiveDeps() {
     local so found foundso
     for so in "${autoPatchelfCachedDeps[@]}"; do
         for found in $(getDepsFromSo "$so"); do
-            local libdir="${found%/*}"
             local base="${found##*/}"
             local soname="${base%.so*}"
             for foundso in "${found%/*}/$soname".so*; do
@@ -113,7 +112,8 @@ findDependency() {
 autoPatchelfFile() {
     local dep rpath="" toPatch="$1"
 
-    local interpreter="$(< "$NIX_CC/nix-support/dynamic-linker")"
+    local interpreter
+    interpreter="$(< "$NIX_CC/nix-support/dynamic-linker")"
     if isExecutable "$toPatch"; then
         runPatchelf --set-interpreter "$interpreter" "$toPatch"
         if [ -n "$runtimeDependencies" ]; then
@@ -129,7 +129,8 @@ autoPatchelfFile() {
     # clear the RPATH first.
     runPatchelf --remove-rpath "$toPatch"
 
-    local missing="$(
+    local missing
+    missing="$(
         ldd "$toPatch" 2> /dev/null | \
             sed -n -e 's/^[\t ]*\([^ ]\+\) => not found.*/\1/p'
     )"
@@ -137,7 +138,6 @@ autoPatchelfFile() {
     # This ensures that we get the output of all missing dependencies instead
     # of failing at the first one, because it's more useful when working on a
     # new package where you don't yet know its dependencies.
-    local -i depNotFound=0
 
     for dep in $missing; do
         echo -n "  $dep -> " >&2
@@ -220,7 +220,7 @@ autoPatchelf() {
       # Jump file if patchelf is unable to parse it
       # Some programs contain binary blobs for testing,
       # which are identified as ELF but fail to be parsed by patchelf
-      patchelf $file || continue
+      patchelf "$file" || continue
       autoPatchelfFile "$file"
     done < <(find "$@" ${norecurse:+-maxdepth 1} -type f -print0)