summarylogtreecommitdiffstats
path: root/update.sh
blob: 80dee42536dc8e6944095a4f618bb449a4e590f0 (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
#!/bin/bash
source PKGBUILD

if [ "${pkgver}" == "${1}" ]; then
    echo "Same version as PKGBUILD; nothing to do"
    exit 0
fi

echo "Updating PKGBUILD file with latest upstream release"

sed -i "s/pkgver=${pkgver}/pkgver=${1}/g" PKGBUILD
sed -i "s/${pkgver}/${1}/g" .SRCINFO
source PKGBUILD 

for type in source sha256sums; do
    for architecture in ${arch[@]}; do
        if [ "$type" == "source" ]; then
            domain=${type}_${architecture}
            curl -o ${architecture}.tmp https://releases.aptakube.com/aptakube_${pkgver}_amd64.AppImage
            shasum=$(sha256sum ${architecture}.tmp)
            echo "sha256sums_${architecture}=('${shasum%%[[:space:]]*}')"
            sed -i "s/sha256sums_${architecture}=.*/sha256sums_${architecture}=('${shasum%%[[:space:]]*}')/g" PKGBUILD
            sed -i "s/sha256sums_${architecture} = .*/sha256sums_${architecture} = ${shasum%%[[:space:]]*}/g" .SRCINFO
            rm ${architecture}.tmp
        fi
    done
done
sudo -u nobody makepkg --printsrcinfo > .SRCINFO