summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDaniel Schaefer <git@danielschaefer.me>2019-05-01 03:19:02 +0200
committerDaniel Schaefer <git@danielschaefer.me>2019-05-25 16:15:54 +0200
commit4a1e51f957b57f781fbdd2e40ca48ebac886e974 (patch)
treee2fd36b78af40424d6ad68fed8e9bc59edcac551 /pkgs
parent81d3bd60a46d0f3eba92ca2659b4cbef50745368 (diff)
downloadnixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.tar
nixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.tar.gz
nixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.tar.bz2
nixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.tar.lz
nixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.tar.xz
nixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.tar.zst
nixpkgs-4a1e51f957b57f781fbdd2e40ca48ebac886e974.zip
patchShebangs: Allow for multiple arguments
It's tempting to think patchShebangs supports multiple arguments.
Without this patch it just silently ignores all but the first. Now it
patches the shebangs in all of its arguments.

Fixes: #57695
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh13
1 files changed, 5 insertions, 8 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 1dac1ca4d7b..3a879db2c0a 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -9,8 +9,9 @@
 
 fixupOutputHooks+=(patchShebangsAuto)
 
-# Run patch shebangs on a directory.
-# patchShebangs [--build | --host] directory
+# Run patch shebangs on a directory or file.
+# Can take multiple paths as arguments.
+# patchShebangs [--build | --host] PATH...
 
 # Flags:
 # --build : Lookup commands available at build-time
@@ -31,9 +32,7 @@ patchShebangs() {
         shift
     fi
 
-    local dir="$1"
-
-    header "patching script interpreter paths in $dir"
+    header "patching script interpreter paths in $@"
     local f
     local oldPath
     local newPath
@@ -42,8 +41,6 @@ patchShebangs() {
     local oldInterpreterLine
     local newInterpreterLine
 
-    [ -e "$dir" ] || return 0
-
     local f
     while IFS= read -r -d $'\0' f; do
         isScript "$f" || continue
@@ -97,7 +94,7 @@ patchShebangs() {
                 rm "$timestamp"
             fi
         fi
-    done < <(find "$dir" -type f -perm -0100 -print0)
+    done < <(find "$@" -type f -perm -0100 -print0)
 
     stopNest
 }