Ensure that updating the file preserves its mode

Preserve the file mode when replacing it, this notably keeps
docs/doxygen/regen.sh executable when running misc/scripts/inc_year.

This uses GNU chmod --reference option which is not available on all
systems, but it shouldn't be a problem in practice.
This commit is contained in:
Vadim Zeitlin
2020-03-06 00:54:46 +01:00
parent c09fd8b59d
commit 28d738e44a

View File

@@ -37,6 +37,7 @@ run_sed() {
rm $filename.$$
msgc "unchanged"
else
chmod --reference=$filename $filename.$$
mv $filename.$$ $filename
msgc "done"
fi