#!/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; } cd "pkg/${PKG}" || return $? # build and copy to /home/custompkgs aur build -c || return $? ## build # makepkg -Ccsr || return $? ## copy to /home/custompkgs # cp "${PKG}-"*.pkg.tar.zst /home/custompkgs/ || return $? cd ../.. || return $? } function build-all() { for PKG in pkg/*; do build-pkg "$(basename "${PKG}")" || return $? done } function main() { # usage: # either zero arguments to build all packages # or the names of the packages to build as arguments 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 arch-repo-push-new || exit } main "$@"