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.
This commit is contained in:
John 2019-10-21 00:13:40 +02:00 committed by John Zimmermann
parent a93c02d3cc
commit e351f6b462
1 changed files with 1 additions and 5 deletions

View File

@ -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
}