summaryrefslogtreecommitdiffstats
path: root/upgpkg
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-11-07 09:10:59 +0100
committerFlorian Pritz <bluewind@xinu.at>2011-11-07 09:10:59 +0100
commit8e42cf6d3095398a295aa5508d604dca0ede98e6 (patch)
treee61e36079e59bad2342934b33544f3eb8de01c47 /upgpkg
parenta30f36671d7626c8936b01036272f76282ba38bb (diff)
downloadbin-8e42cf6d3095398a295aa5508d604dca0ede98e6.tar.gz
bin-8e42cf6d3095398a295aa5508d604dca0ede98e6.tar.xz
upgpkg: add comments; make awk script more readable
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'upgpkg')
-rwxr-xr-xupgpkg13
1 files changed, 12 insertions, 1 deletions
diff --git a/upgpkg b/upgpkg
index 2c3963e..ef8388f 100755
--- a/upgpkg
+++ b/upgpkg
@@ -103,7 +103,18 @@ fi
sed -i "s/pkgver=.*$/pkgver=$1/g" PKGBUILD
sed -i "s/pkgrel=.*$/pkgrel=1/g" PKGBUILD
makepkg -g || exit 1
-awk <PKGBUILD '$0 ~ /^(md5|sha[0-9]+)sums/ {i = 1; if(!run==1) {system("makepkg -g 2>/dev/null")}; run=1; }; !i {print}; $0 ~ /\)/ {i = 0}' | sponge PKGBUILD
+# replace the first checksum line with all checksums, remove all other checksums
+# TODO: this doesn't work if there are no checksum lines or if the makepkg call
+# inside the awk script doesn't return anything
+# original awk by Pierre https://projects.archlinux.de/kde-build.git/tree/common/updpkg
+awk <PKGBUILD '
+$0 ~ /^(md5|sha[0-9]+)sums/ {
+ i = 1;
+ if(!run==1) {system("makepkg -g 2>/dev/null")};
+ run=1;
+};
+!i {print};
+$0 ~ /\)/ {i = 0}' | sponge PKGBUILD
source PKGBUILD
if [ -f "upgpkg" ]; then