From 6e6e7e6329a66c3cd73d98a09cb077a4f95de28a Mon Sep 17 00:00:00 2001 From: goodroot Date: Sat, 6 Sep 2025 15:33:59 -0700 Subject: [PATCH] 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 --- PKGBUILD | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/PKGBUILD b/PKGBUILD index a8832062e410..2702b2425d3b 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -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}"