mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-26 12:53:59 +03:00
patchShebangs: preserve times, resolves #33084
Close #33281. Edits by vcunat: - use Eelco's idea: empty file instead of full copy - use longer name suffix to decrease the likelihood of collision
This commit is contained in:
parent
ba6e0ae33d
commit
4b1b6ee6d1
@ -54,7 +54,11 @@ patchShebangs() {
|
||||
echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""
|
||||
# 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"
|
||||
sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"
|
||||
touch -r "$f.timestamp" "$f"
|
||||
rm "$f.timestamp"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user