summaryrefslogtreecommitdiffstats
path: root/arch/tde-deps/pod2man/update.sh
blob: b176cad88854138f4fb9f9f171e336804b976f29 (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
#!/usr/bin/env bash

get_latest() {
  wget -q -O- 'https://github.com/kimwalisch/primesieve/wiki/Downloads' | \
  sed -n 's,.*primesieve-\([0-9][^>]*\)\.tar.*,\1,p' | \
  grep -v '\(linux\|mac\|win\)' | \
  sort -r | \
  head -1
}

latest_version=$1
#latest_version=$(get_latest)
current_version=$(cat PKGBUILD | grep pkgver= | awk -F'=' '{print $2}')

if ! [ "$latest_version" = "$current_version" ]; then
  echo Updating the package with the latest version
  echo latest: $latest_version
  echo current: $current_version
  sed -i.bak "s/$current_version/$latest_version/g" PKGBUILD
  sed -i.bak "s/pkgrel=[^d.]/pkgrel=1/g" PKGBUILD
  ./pkgsum.sh
  if which makepkg &> /dev/null; then
    makepkg --printsrcinfo > .SRCINFO
  else
    mksrcinfo
  fi
else
  echo Nothing to update.
fi