diff options
author | Nicolas Mattia <nicolas@nmattia.com> | 2019-04-25 17:07:58 +0200 |
---|---|---|
committer | Nicolas Mattia <nicolas@nmattia.com> | 2019-04-25 17:07:58 +0200 |
commit | cc9b4029bc7ec91237ce44d04230b921005db6a0 (patch) | |
tree | 1110800eac810b869f98d752f5693bd385c9fb7e /pkgs/build-support/setup-hooks/patch-shebangs.sh | |
parent | 82f338b83701cb1fb87d0b6a83ca20b4dca4f9eb (diff) | |
download | nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.tar nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.tar.gz nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.tar.bz2 nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.tar.lz nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.tar.xz nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.tar.zst nixpkgs-cc9b4029bc7ec91237ce44d04230b921005db6a0.zip |
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
Diffstat (limited to 'pkgs/build-support/setup-hooks/patch-shebangs.sh')
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 7 |
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 |