summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/patch-shebangs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support/setup-hooks/patch-shebangs.sh')
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 1433d1e1f14..73fe23f88be 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -55,10 +55,11 @@ patchShebangs() {
                 # escape the escape chars so that sed doesn't interpret them
                 escapedInterpreterLine=$(echo "$newInterpreterLine" | sed 's|\\|\\\\|g')
                 # Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281
-                touch -r "$f" "$f.timestamp"
+                timestamp=$(mktemp)
+                touch -r "$f" "$timestamp"
                 sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
-                touch -r "$f.timestamp" "$f"
-                rm "$f.timestamp"
+                touch -r "$timestamp" "$f"
+                rm "$timestamp"
             fi
         fi
     done