summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2018-09-28 11:21:51 -0500
committerWill Dietz <w@wdtz.org>2018-09-28 11:21:51 -0500
commitf7db287960241736213c0f262ad655ce40cfc624 (patch)
treeea094e48c4b4ddca23bfcf16908d6b01863e2c6c /pkgs/build-support
parent286381f0727a5aee3413c24989ad5fb609653c49 (diff)
downloadnixlib-f7db287960241736213c0f262ad655ce40cfc624.tar
nixlib-f7db287960241736213c0f262ad655ce40cfc624.tar.gz
nixlib-f7db287960241736213c0f262ad655ce40cfc624.tar.bz2
nixlib-f7db287960241736213c0f262ad655ce40cfc624.tar.lz
nixlib-f7db287960241736213c0f262ad655ce40cfc624.tar.xz
nixlib-f7db287960241736213c0f262ad655ce40cfc624.tar.zst
nixlib-f7db287960241736213c0f262ad655ce40cfc624.zip
patch-shebangs.sh: use more robust 'for each file' loop, check for dir
The latter is to avoid warnings printed by find if it doesn't exist.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 18eb011b0c79..d26bf735d30a 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -18,7 +18,10 @@ patchShebangs() {
     local oldInterpreterLine
     local newInterpreterLine
 
-    find "$dir" -type f -perm -0100 | while read f; do
+    [ -e "$dir" ] || return 0
+
+    local f
+    while IFS= read -r -d $'\0' f; do
         isScript "$f" || continue
 
         oldInterpreterLine=$(head -1 "$f" | tail -c+3)
@@ -58,7 +61,7 @@ patchShebangs() {
                 rm "$f.timestamp"
             fi
         fi
-    done
+    done < <(find "$dir" -type f -perm -0100 -print0)
 
     stopNest
 }