Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/contrib/updpkgsums.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-01-02 21:43:56 +1000
committerAllan McRae <allan@archlinux.org>2015-01-02 21:43:56 +1000
commitfafcbdeb8c7af439f2f3b85fa82f27b1dd4a3f79 (patch)
tree66a885c0be9dbc9d3049e69fb43624a9f04e2830 /contrib/updpkgsums.sh.in
parentf1e010a5a7c562da02a74ffb043520760db49ba3 (diff)
parent89b9e9d1dced68587b704cb9e9a2aab55fb60b06 (diff)
Merge branch 'maint'
Diffstat (limited to 'contrib/updpkgsums.sh.in')
-rw-r--r--contrib/updpkgsums.sh.in8
1 files changed, 3 insertions, 5 deletions
diff --git a/contrib/updpkgsums.sh.in b/contrib/updpkgsums.sh.in
index b0d2d69e..7b92efe3 100644
--- a/contrib/updpkgsums.sh.in
+++ b/contrib/updpkgsums.sh.in
@@ -82,9 +82,6 @@ fi
export BUILDDIR=$(mktemp -d --tmpdir updpkgsums.XXXXXX)
newbuildfile=$(mktemp --tmpdir updpkgsums.XXXXXX)
-# In case the eventual replacement fails, we don't want to leave behind
-# $newbuildfile as garbage in $TMPDIR. This fails silently if the replacement
-# succeeds.
trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT
newsums=$(makepkg -g -p "$buildfile") || die 'Failed to generate new checksums'
awk -v newsums="$newsums" '
@@ -100,8 +97,9 @@ awk -v newsums="$newsums" '
END { if (!w) print newsums }
' "$buildfile" > "$newbuildfile" || die 'Failed to write new PKGBUILD'
-# Replace the original buildfile.
-if ! mv -- "$newbuildfile" "$buildfile"; then
+# Rewrite the original buildfile. Use cat instead of mv/cp to preserve
+# permissions implicitly.
+if ! cat -- "$newbuildfile" >"$buildfile"; then
die "Failed to update %s. The file has not been modified." "$buildfile"
fi