summarylogtreecommitdiffstats
path: root/update2.sh
blob: cd8aa64cf21df4c441ae5e75d8d256941490b352 (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
37
38
39
40
41
42
43
44
#!/bin/bash

set -eo pipefail +H

DEB_REPO=http://repos.tixeo.com/debian
SUITE=bullseye
COMPONENT=non-free
ARCH=amd64
PACKAGE=tixeoclient

s_dir="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
cd $s_dir

built_ver=`grep ^pkgver= PKGBUILD | cut -d= -f2`

t_packages=`mktemp`
trap 'rm -f $t_packages' EXIT
curl -s $DEB_REPO/dists/$SUITE/$COMPONENT/binary-$ARCH/Packages | sed -n -e "/^Package: $PACKAGE$/,/^$/{/^$/!p}" > $t_packages

upstream_ver=`grep "^Version:" $t_packages | sed -e 's/\w\+: //'`

if [ -z "$upstream_ver" ] ; then
    echo "Unable to retrieve latest upstream $PACKAGE version"
    exit 1
fi

if [ $upstream_ver = $built_ver ] ; then
    exit
fi

echo "New upstream version available : $upstream_ver (last build is $built_ver)"

sed -i -e "s/^pkgver=.*/pkgver=$upstream_ver/" PKGBUILD
sed -i -e "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
updpkgsums -m

echo "Building package"
makepkg --skippgpcheck -CcLmfd | tee $s_dir/build.log

# Build is successful, will push to aur
makepkg --printsrcinfo > .SRCINFO
git add PKGBUILD .SRCINFO
git commit -m "Released $upstream_ver"
git push