summarylogtreecommitdiffstats
path: root/upgrade
blob: 30c28375931251c4a634e93a2c4ae310e5c54064 (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
#!/usr/bin/env bash

set -eu

version="${1:-}"
own_dir="$(dirname "${BASH_SOURCE[0]}")"

if [ -z "${version:-}" ]; then
  echo "Usage: ${BASH_SOURCE[0]} VERSION"
  exit 1
fi

pkgbuild="${own_dir}/PKGBUILD"
source ${pkgbuild}

echo "old version: $pkgver"
old_version="${pkgver}"
if [ "${version}" == "${pkgver}" ]; then
  echo "version must be different from old version"
  exit 1
fi

sed -i "s/pkgver=.*/pkgver=${version}/" "${pkgbuild}"
source ${pkgbuild}

src_url="${source[0]}"
echo "downloading from $src_url to calculate digest"
digest=$(curl -L "${src_url}" | b2sum | cut -d' ' -f1)

sed -i "s/b2sums=.*/b2sums=('${digest}')/" "${pkgbuild}"

srcinfo="${own_dir}/.SRCINFO"

old_version_re=$(echo "${old_version}" | sed "s/\./\\\./g")
sed -i "s/${old_version_re}/${version}/g" "${srcinfo}"

sed -i "s/b2sums =.*/b2sums = ${digest}/" "${srcinfo}"