2021-07-22 03:46:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
|
|
|
|
RED=$(tput setaf 1)
|
|
|
|
BOLD=$(tput bold)
|
|
|
|
RESET=$(tput sgr0)
|
|
|
|
readonly RED BOLD RESET
|
|
|
|
|
|
|
|
traperr() {
|
|
|
|
s=$?
|
|
|
|
echo "$0: $BASH_COMMAND"
|
|
|
|
exit $s
|
|
|
|
}
|
|
|
|
|
|
|
|
trap traperr ERR
|
|
|
|
|
2021-10-29 06:46:08 +00:00
|
|
|
PACKAGES=("$@")
|
|
|
|
EXTRA_ARGS=()
|
2021-07-22 03:46:19 +00:00
|
|
|
|
|
|
|
if [ ${#PACKAGES[@]} -eq 0 ]; then
|
|
|
|
echo "${BOLD}${RED}ERROR:${RESET}${BOLD} no packages specified${RESET}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
for package in "${PACKAGES[@]}"; do
|
|
|
|
(
|
|
|
|
# change to package directory
|
2021-10-29 06:46:08 +00:00
|
|
|
cd "$package" || exit 1
|
|
|
|
|
|
|
|
# capture output for parsing dependencies
|
|
|
|
makepkg_output=$(makepkg --printsrcinfo)
|
|
|
|
|
|
|
|
# cache downloaded crates
|
|
|
|
if grep -q "depends = rust\|cargo" <<<"$makepkg_output"; then
|
|
|
|
EXTRA_ARGS+=(--bind-rw /var/cache/cargo:/build/.cargo)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# cache downloaded modules
|
|
|
|
if grep -q "depends = go" <<<"$makepkg_output"; then
|
|
|
|
EXTRA_ARGS+=(--bind-rw /var/cache/golang:/build/go)
|
|
|
|
fi
|
2021-07-22 03:46:19 +00:00
|
|
|
|
|
|
|
# build signed package in chroot & add to local repo
|
|
|
|
aur build \
|
|
|
|
--chroot \
|
|
|
|
--gpg-sign \
|
|
|
|
--remove \
|
|
|
|
--force \
|
2021-10-29 06:46:08 +00:00
|
|
|
--makepkg-conf=/etc/aurutils/makepkg-grawlinson.conf \
|
|
|
|
"${EXTRA_ARGS[@]}"
|
2021-10-29 22:34:38 +00:00
|
|
|
|
|
|
|
# reset EXTRA_ARGS
|
|
|
|
EXTRA_ARGS=()
|
2021-07-22 03:46:19 +00:00
|
|
|
)
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 et
|