aptakube-deb-aur/update.sh
Jonas Leder b9f805f829 Run makepkg --printsrcinfo in a scratch dir
nobody cannot write to the checkout on the Forgejo runner.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 17:22:27 +01:00

33 lines
1.2 KiB
Bash
Executable file

#!/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.deb
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
# makepkg runs as nobody, which cannot write to the checkout (owned by the runner user): use a scratch dir
tmpdir=$(mktemp -d)
cp PKGBUILD "${tmpdir}/"
chmod 777 "${tmpdir}"
(cd "${tmpdir}" && sudo -u nobody makepkg --printsrcinfo) > .SRCINFO
rm -rf "${tmpdir}"