Revert "Revert "stdenv/patchShebangs: avoid temporary time reference file""
This reverts commit df21fb8afa235a71b4e814f1ed1c4003ce34b220.
This commit is contained in:
parent
e95bf38429
commit
2bd3aa4bc2
@ -88,17 +88,15 @@ patchShebangs() {
|
|||||||
newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}
|
newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}
|
||||||
|
|
||||||
if [[ -n "$oldPath" && "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]]; then
|
if [[ -n "$oldPath" && "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ]]; then
|
||||||
if [[ -n "$newPath" ]] && [[ "$newPath" != "$oldPath" ]]; then
|
if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then
|
||||||
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
|
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
|
||||||
# escape the escape chars so that sed doesn't interpret them
|
# escape the escape chars so that sed doesn't interpret them
|
||||||
escapedInterpreterLine=${newInterpreterLine//\\/\\\\}
|
escapedInterpreterLine=${newInterpreterLine//\\/\\\\}
|
||||||
|
|
||||||
# Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281
|
# Preserve times, see: https://github.com/NixOS/nixpkgs/pull/33281
|
||||||
timestamp=$(mktemp)
|
timestamp=$(stat --printf "%y" "$f")
|
||||||
touch -r "$f" "$timestamp"
|
|
||||||
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
|
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
|
||||||
touch -r "$timestamp" "$f"
|
touch --date "$timestamp" "$f"
|
||||||
rm "$timestamp"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < <(find "$@" -type f -perm -0100 -print0)
|
done < <(find "$@" -type f -perm -0100 -print0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user