vp-build/common/hooks/post-install/03-remove-empty-dirs.sh

13 lines
385 B
Bash
Raw Normal View History

# This hooks removes empty dirs and warns about them.
hook() {
find "${PKGDESTDIR}" -type d -empty|sort -r|while read f; do
_dir="${f##${PKGDESTDIR}}"
[ -z "${_dir}" ] && continue
2015-04-25 13:30:01 +02:00
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}
}