summarylogtreecommitdiffstats
path: root/fetch-version.sh
blob: b6c53adeedae2a7e9e3ae478cad02d2822d761aa (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
#!/usr/bin/env bash

set -euo pipefail

url='https://zoom.us/download?os=linux'

printf "Fetching current version... "
curver=$(curl -s "$url" | grep -oP 'Version \K[0-9. ()]+' | perl -pne 's/\.\d+ /./;s/[\(\)]//g')
printf "done!\n"

printf "Reading local package version... "
pkgv=$( ( set +u; source PKGBUILD; echo "$pkgver") )
printf "done!\n"

printf "Package version:\t%s\n" "$pkgv"
printf "Latest available:\t%s\n" "$curver"

case $(vercmp "$curver" "$pkgv") in
        0)
                echo "Up to date"
                ;;
        1)
                echo "Newer version available"
                ;;
        -1)
                echo "Local version is newer (??)"
                ;;
        *) 
                echo "Unknown vercmp result"
                ;;
esac