[PATCH] add upgpkg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Signed-off-by: Florian Pritz <bluewind@xxxxxxx>
---
 upgpkg |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100755 upgpkg

diff --git a/upgpkg b/upgpkg
new file mode 100755
index 0000000..7966ac3
--- /dev/null
+++ b/upgpkg
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# upgpkg: Upgrades package versions in PKGBUILD and starts build.
+# Author: Abhishek Dasgupta <abhidg@xxxxxxxxx>
+#         Thanks to cactus, profjim and daenyth for all the sed help!
+# Edited: Florian Pritz <flo@xxxxxxx>
+
+# I place this script in the public domain.
+
+VERSION=0.2
+
+die() {
+    local message="$1"
+    shift
+    printf "$(gettext "Error: $message")\n" "$@"
+    exit 1
+}
+
+if [ -z "$1" ]; then 
+  echo "upgpkg $VERSION"
+  printf "$(gettext "usage: upgpkg newver")\n"
+  exit 2
+fi
+
+# Main code follows
+
+[ ! -f PKGBUILD ] && die "No \"%s\" in %s" "PKGBUILD" "$PWD"
+
+sed -ri '/(md5sums|sha[0-9]+sums)[ ]?\=/{:a; /\)/d; N; ba;}' PKGBUILD || die "Could not bump pkgver"
+source PKGBUILD
+
+if [ $(vercmp $1 $pkgver) -gt 0 ]; then
+    sed -i "s/pkgver=.*$/pkgver=$1/g" PKGBUILD
+    sed -i "s/pkgrel=.*$/pkgrel=1/g" PKGBUILD
+    makepkg -g >> PKGBUILD
+else
+    die "New version (%s) older or equal to current %s" "$1" "$pkgver"
+fi
+
+if [ -x "rebuild" ]; then
+  ./rebuild
+else
+  makepkg
+fi
-- 
1.7.3.2


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux