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:
authorDave Reisner <dreisner@archlinux.org>2014-12-18 23:20:22 -0500
committerAllan McRae <allan@archlinux.org>2014-12-19 14:31:01 +1000
commit565c931e2c684d4460ff65cbec9b097ee1d8f94d (patch)
treea42e3678e28e5aab38a41da02ea284d23c8a0453 /contrib/updpkgsums.sh.in
parentbc6ada0877010891e5c2336fd5c1242047e6a7a5 (diff)
updpkgsums: add more error checking before replacementv4.2.0
Re-add some paranoia which was inadvertently lost with 768b65e934. In case 'makepkg -g' fails to generate new sums (e.g. when a remote resource cannot be fetched), or awk fails to write the new file (i have no idea when this would happen), bail out with an error. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'contrib/updpkgsums.sh.in')
-rw-r--r--contrib/updpkgsums.sh.in4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/updpkgsums.sh.in b/contrib/updpkgsums.sh.in
index a40845b6..b0d2d69e 100644
--- a/contrib/updpkgsums.sh.in
+++ b/contrib/updpkgsums.sh.in
@@ -86,7 +86,7 @@ newbuildfile=$(mktemp --tmpdir updpkgsums.XXXXXX)
# $newbuildfile as garbage in $TMPDIR. This fails silently if the replacement
# succeeds.
trap "rm -rf '$BUILDDIR' '$newbuildfile'" EXIT
-newsums=$(makepkg -g -p "$buildfile") &&
+newsums=$(makepkg -g -p "$buildfile") || die 'Failed to generate new checksums'
awk -v newsums="$newsums" '
/^[[:blank:]]*(md|sha)[[:digit:]]+sums(_[^=]+)?=/,/\)[[:blank:]]*(#.*)?$/ {
if (!w) {
@@ -98,7 +98,7 @@ awk -v newsums="$newsums" '
1
END { if (!w) print newsums }
-' "$buildfile" > "$newbuildfile"
+' "$buildfile" > "$newbuildfile" || die 'Failed to write new PKGBUILD'
# Replace the original buildfile.
if ! mv -- "$newbuildfile" "$buildfile"; then