[pacman-dev] [PATCH] Remove existing pkg/ dir only if it's not empty.

Esa Määttä esa.maatta at iki.fi
Tue Feb 1 07:22:23 EST 2011


This allows symbolic linking of the pkg directory. Without this patch the
symbolic link to an another directory would be removed as existing pkg/
directory.

Signed-off-by: Esa Määttä <esa.maatta at iki.fi>
---
 scripts/makepkg.sh.in |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b1b1b75..bd2739b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2056,8 +2056,8 @@ if (( NOBUILD )); then
 	msg "$(gettext "Sources are ready.")"
 	exit 0 #E_OK
 else
-	# check for existing pkg directory; don't remove if we are repackaging
-	if [[ -d $pkgdir ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then
+	# check for existing non empty pkg directory; don't remove if we are repackaging
+	if [[ -n $(ls -A "$pkgdir" 2>/dev/null) ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then
 		msg "$(gettext "Removing existing pkg/ directory...")"
 		rm -rf "$pkgdir"
 	fi
-- 
1.7.4



More information about the pacman-dev mailing list