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 }