summarylogtreecommitdiffstats
path: root/update_version.sh
blob: add7850a17462e23830742b5d8ead91dbe3cf6b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
PKG=`curl https://apt.connectify.me/dists/speedify/main/binary-amd64/Packages`
NVERSION=`echo "$PKG"|grep Version|head -1|cut -d" " -f2`
CVERSION=`cat PKGBUILD |grep _pkgver=|cut -d= -f2`
MD5=$(echo "$PKG"|grep MD5sum|head -1|cut -d" " -f2)
SHA5=$(echo "$PKG"|grep SHA512|head -1|cut -d" " -f2)
SHA2=$(echo "$PKG"|grep SHA256|head -1|cut -d" " -f2)

echo "Versions: '$NVERSION' '$CVERSION'"
if [ $NVERSION != $CVERSION ]; then
    echo "Updating ..."
    sed -i "s/$CVERSION/$NVERSION/g" PKGBUILD
    sed -i "s/\(md5sums_x86_64=\).*/\1('$MD5')/" PKGBUILD
    sed -i "s/\(sha512sums_x86_64=\).*/\1('$SHA5')/" PKGBUILD
    sed -i "s/\(sha256sums_x86_64=\).*/\1('$SHA2')/" PKGBUILD
    sed -i "s/pkgrel=.*/pkgrel=0/" PKGBUILD
    #to see if it build
    makepkg
    makepkg --printsrcinfo > .SRCINFO
    git commit -am "New version $NVERSION"
    git push
fi