From e351f6b462089b00e59df85e66bc1dcac4474cec Mon Sep 17 00:00:00 2001 From: John Date: Mon, 21 Oct 2019 00:13:40 +0200 Subject: [PATCH] hooks/post-install/03-remove-empty-dirs.sh: use find -delete instead of rmdir -p rmdir -p could end up deleting even /destdir when a empty package would not have any subpackages with a i686 masterdir. --- common/hooks/post-install/03-remove-empty-dirs.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/common/hooks/post-install/03-remove-empty-dirs.sh b/common/hooks/post-install/03-remove-empty-dirs.sh index 4b7122938ab..c54f458f61e 100644 --- a/common/hooks/post-install/03-remove-empty-dirs.sh +++ b/common/hooks/post-install/03-remove-empty-dirs.sh @@ -2,13 +2,9 @@ hook() { if [ -d "${PKGDESTDIR}" ]; then - find "${PKGDESTDIR}" -type d -empty|sort -r|while read f; do + find "${PKGDESTDIR}" -mindepth 1 -type d -empty -print -delete|sort -r|while read f; do _dir="${f##${PKGDESTDIR}}" - [ -z "${_dir}" ] && continue - rmdir --ignore-fail-on-non-empty -p "$f" &>/dev/null msg_warn "$pkgver: removed empty dir: ${_dir}\n" done - # Create PKGDESTDIR in case it has been removed previously. - mkdir -p ${PKGDESTDIR} fi }