diff --git a/common/hooks/post-install/03-remove-empty-dirs.sh b/common/hooks/post-install/03-remove-empty-dirs.sh index 0d8b74bba38..dec7898744a 100644 --- a/common/hooks/post-install/03-remove-empty-dirs.sh +++ b/common/hooks/post-install/03-remove-empty-dirs.sh @@ -1,8 +1,7 @@ # This hooks removes empty dirs and warns about them. hook() { - for f in $(find ${PKGDESTDIR} -type d -empty|sort -r|tr " " "|"); do - f="${f//|/ }" + find "${PKGDESTDIR}" -type d -empty|sort -r|while read f; do _dir="${f##${PKGDESTDIR}}" [ -z "${_dir}" ] && continue rmdir --ignore-fail-on-non-empty -p "$f" &>/dev/null