Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

1. support all hash types

2. rename appropriately
3. don't replace checksums with null
  • Loading branch information...
commit 35d78ad774070c7e40ca3819eb313276c50a447e 1 parent bf41d03
@zizzfizzix authored
Showing with 19 additions and 15 deletions.
  1. +0 −15 pkgmd5
  2. +19 −0 pkgsums
View
15 pkgmd5
@@ -1,15 +0,0 @@
-#!/bin/sh
-# automatically replace old md5sum with new in PKGBUILDs
-# TODO: make md5sums configurable to sha256sums etc.
-
-exec 2>/dev/null
-
-file=PKGBUILD
-
-if [[ -w $1 ]]; then file=$1; fi
-
-if [[ ! $(grep ^md5sums $file) ]]; then
- sed -i "s|^source.*|&\n$(makepkg -g -p $file)|" $file
-else
- sed -i "s|^md5sums.*|$(makepkg -g -p $file)|" $file
-fi
View
19 pkgsums
@@ -0,0 +1,19 @@
+#!/bin/bash
+# automatically replace old checksums with new in PKGBUILDs
+# TODO: make it work with several source files (multiline)
+
+exec 2>/dev/null
+
+file=PKGBUILD
+if [[ -w $1 ]]; then file=$1; fi
+new_sum=$(makepkg -g -p ${file})
+
+if [[ ${new_sum} ]]; then
+ if [[ ! $(grep 'sums=(' ${file}) ]]; then
+ sed -i "s|^source.*|&\n${new_sum}|" ${file}
+ else
+ sed -i "s|.*sums=(.*|${new_sum}|" ${file}
+ fi
+else
+ exit 1
+fi
Please sign in to comment.
Something went wrong with that request. Please try again.