summarylogtreecommitdiffstats
path: root/upgrade.sh
blob: a32a2db2568102682875767de72f0436d47ae81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash

set -e

current=`grep pkgver= PKGBUILD | cut -d'=' -f 2`
latest=`git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/axllent/mailpit \
	| grep -v '{}' \
	| awk '{ print $2 }' \
	| tail -n 1 \
	| cut -d'/' -f 3 \
	| tr -d 'v'`

if [ $current = $latest ]; then
	echo "nothing to upgrade"
	exit 0
fi

echo "upgrading to $latest"

sed -i "s/pkgver=.*/pkgver=$latest/" PKGBUILD

cat PKGBUILD | sed -n '/#/,/sha256sums/p' | head -n -1 > PKGNEW
mv PKGNEW PKGBUILD

makepkg --skipchecksums -o

makepkg -g >> PKGBUILD
makepkg --printsrcinfo > .SRCINFO

makepkg -si

sudo systemctl restart mailpit.service

git add .SRCINFO
git add PKGBUILD
git commit -m "pump to $latest"