summaryrefslogtreecommitdiff
path: root/update.sh
blob: ba04dffac72d7b1343765c562ad9326b44f44e3c (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
45
46
47
#!/bin/bash

set -e

pkg="${1%:}"
version="$2"

cd /usr/src/ports/*/${pkg}
oldVer=$(
  sed '
    s/^version=//
    t
    d
  ' Pkgfile
)
if [ -z "${version}" ]; then
  version="${oldVer}"
fi
if [ "${oldVer}" = "${version}" ]; then
  release=$((
    1+$(
      sed '
        s/^release=//
        t
        d
      ' Pkgfile
    )
  ))
  sed -i '
    /^release=/ s/=.*$/='"${release}"'/
  ' Pkgfile
else
  sed -i '
    /^version=/ s/=.*$/='"${version}"'/
  ' Pkgfile
fi
sudo -u pkgmk fakeroot pkgmk -if -im -is -d
pkgmk -uf
pkgmk -um
pkgmk -us -sk /etc/ports/deepthought.sec
if [ "${oldVer}" = "${version}" ]; then
  git commit . -m "${pkg}: rebuild"
else
  git commit . -m "${pkg}: ${oldVer} -> ${version}"
fi

echo 'Erfolg!'