Add robust error checking to PKGBUILD package() function

- Add error handling for cd command failure
- Verify source directory contains expected files before copying
- Add debugging output to identify cp errors
- This should fix the permission denied errors during AUR builds
This commit is contained in:
goodroot 2025-09-06 15:33:59 -07:00
parent c0bfdd3560
commit 6e6e7e6329

View file

@ -40,7 +40,19 @@ sha256sums=(
)
package() {
cd "${srcdir}/${pkgname}-${pkgver}"
# Ensure we're in the correct source directory
cd "${srcdir}/${pkgname}-${pkgver}" || {
echo "ERROR: Failed to change to source directory: ${srcdir}/${pkgname}-${pkgver}"
exit 1
}
# Verify we're in the right place
if [ ! -f "PKGBUILD" ] || [ ! -d "lib" ]; then
echo "ERROR: Source directory doesn't contain expected files"
echo "Current directory: $(pwd)"
echo "Contents: $(ls -la)"
exit 1
fi
# Create installation directory
install -dm755 "${pkgdir}/opt/${pkgname}"