From cc9b4029bc7ec91237ce44d04230b921005db6a0 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Thu, 25 Apr 2019 17:07:58 +0200 Subject: patchShebangs: create timestamp in tmp dir Creating the timestamp in the patched script's directory has a few drawbacks: * if "foo.timestamp" already exists, it will be overwritten * it requires the directory to be writable --- pkgs/build-support/setup-hooks/patch-shebangs.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pkgs/build-support/setup-hooks') diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 1433d1e1f144..73fe23f88be2 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 -- cgit 1.4.1