#!/bin/bash mkdir -p out build_package() { local pkg_dir="$1" cd "$pkg_dir" || return if [[ -f PKGBUILD ]]; then echo "Building package in $pkg_dir..." makepkg -s --noconfirm --outputdir ../out else echo "No PKGBUILD found in $pkg_dir, skipping..." fi cd - > /dev/null || return } base_dir="." find "$base_dir" -type f -name 'PKGBUILD' -exec dirname {} \; | while read -r pkg_dir; do build_package "$pkg_dir" done echo "All packages have been built and saved in the 'out' directory."