diff options
Diffstat (limited to 'profiles')
-rw-r--r-- | profiles/common/profile.bashrc | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/profiles/common/profile.bashrc b/profiles/common/profile.bashrc index 84df63fa..01693368 100644 --- a/profiles/common/profile.bashrc +++ b/profiles/common/profile.bashrc @@ -43,9 +43,34 @@ function __drop-nls-locales () { einfo "Removing ${REPLY#${ED}}" rm -rf "${REPLY}" done +} + +function __drop-empty-dir () { + if [[ ! ${ED} ]] ; then + local ED="${D}" + fi - # Drop /usr/share/locale if nothing inside - rmdir "${ED}/usr/share/locale" 2> /dev/null + if [[ ! -d "${ED}" ]] ; then + return 0 + fi + + local i + + while (( i++ < 64 )) && + [[ $(find "${ED}" -type d -empty) ]] ; do + find "${ED}/" \ + -type d \ + -empty | + sort | + while read ; do + einfo "Removing ${REPLY#${ED}}" + rm -rf "${REPLY}" + done + done + + if (( i >= 64 )) ; then + eerror "${FUNCNAME} recursed more than ${i} time, that's bad" + fi } function __install_own_file () { @@ -99,6 +124,7 @@ function post_src_install () { function pre_pkg_preinst () { __drop-nls-man-pages __drop-nls-locales + __drop-empty-dir } # vim: syntax=sh |