2021-04-29 14:49:02 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function build-pkg() {
|
|
|
|
# $1: package-name
|
|
|
|
local PKG
|
|
|
|
PKG="$1"
|
|
|
|
|
|
|
|
# check if PKGBUILD exists, otherwise skip
|
|
|
|
[ -f "pkg/${PKG}/PKGBUILD" ] || {
|
|
|
|
echo "Package ${PKG} does not contain a PKGBUILD file - skipping it!"; return 0;
|
|
|
|
}
|
|
|
|
|
2021-04-29 14:52:03 +02:00
|
|
|
cd "pkg/${PKG}" || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
|
|
|
|
|
2021-04-29 14:52:03 +02:00
|
|
|
# build and copy to /home/custompkgs
|
2021-05-02 18:02:20 +02:00
|
|
|
aur build -c || {
|
|
|
|
echo "Package ${PKG} failed!";
|
|
|
|
FAILED_PKGS+=("${PKG}");
|
|
|
|
}
|
2021-04-29 14:52:03 +02:00
|
|
|
|
|
|
|
## build
|
|
|
|
# makepkg -Ccsr || return $?
|
|
|
|
## copy to /home/custompkgs
|
|
|
|
# cp "${PKG}-"*.pkg.tar.zst /home/custompkgs/ || return $?
|
|
|
|
|
|
|
|
|
|
|
|
cd ../.. || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
2021-04-29 14:52:03 +02:00
|
|
|
|
2021-04-29 14:49:02 +02:00
|
|
|
function build-all() {
|
|
|
|
for PKG in pkg/*; do
|
2021-04-29 14:52:03 +02:00
|
|
|
build-pkg "$(basename "${PKG}")" || return $?
|
2021-04-29 14:49:02 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function main() {
|
|
|
|
# usage:
|
|
|
|
# either zero arguments to build all packages
|
|
|
|
# or the names of the packages to build as arguments
|
|
|
|
|
2021-05-02 18:02:20 +02:00
|
|
|
FAILED_PKGS=()
|
|
|
|
|
2021-04-29 14:49:02 +02:00
|
|
|
|
|
|
|
if [ "$#" -gt "0" ]; then
|
|
|
|
# at least one argument is given
|
|
|
|
|
|
|
|
for PKG in "$@"; do
|
|
|
|
build-pkg "$PKG" || return $?
|
|
|
|
done
|
|
|
|
|
|
|
|
else
|
|
|
|
# no arguments given
|
|
|
|
build-all || return $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
# push remote repository
|
2021-05-02 18:02:20 +02:00
|
|
|
echo ""
|
2021-04-29 14:49:02 +02:00
|
|
|
arch-repo-push-new || exit
|
2021-05-02 18:02:20 +02:00
|
|
|
|
|
|
|
if [ "${#FAILED_PKGS[@]}" -gt "0" ]; then
|
|
|
|
echo ""
|
|
|
|
echo "Warning: Not all packages were build successfully: ${FAILED_PKGS[*]}"
|
|
|
|
return 1
|
|
|
|
|
|
|
|
fi
|
2021-04-29 14:49:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
main "$@"
|