#!/bin/sh
set -e
if [ -d "$1" ]; then
./mpkg.sh $1
exit 0
fi
git clone --depth=100 https://gitlab.archlinux.org/archlinux/packaging/packages/$1.git
(cd $1; ../commitpicker.py)
if ARCHLINE=$(grep "arch=" $1/PKGBUILD); then
if echo "$ARCHLINE" | grep -q armv7h; then
true
elif echo "$ARCHLINE" | grep -q any; then
true
else
sed -i -e "/^arch=/s/[)]/ \'armv7h\'\)/" $1/PKGBUILD
fi
fi
if grep -q "^pkgver=5\.110\." $1/PKGBUILD; then
mv $1/PKGBUILD $1/PKGBUILD.old
./rmsums.py < $1/PKGBUILD.old > $1/PKGBUILD
sed -i -e "s/^pkgver=.*/pkgver=5.115.0/" $1/PKGBUILD
rm $1/PKGBUILD.old
fi
nano $1/PKGBUILD
echo "Enter to build, Ctrl-C to Abort."
read dummy
chown -R builder:builder $1
./mpkg.sh $1