diff options
-rw-r--r-- | profiles/common/profile.bashrc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/profiles/common/profile.bashrc b/profiles/common/profile.bashrc index 46610685..11a872a2 100644 --- a/profiles/common/profile.bashrc +++ b/profiles/common/profile.bashrc @@ -272,6 +272,41 @@ function __install_own_file () { done } +function __drop-distfiles () { + local _r + + if has fetch ${RESTRICT} ; then + continue + elif has mirror ${RESTRICT} ; then + continue + fi + + if [[ -d "${DISTDIR}" ]] ; then + find "${DISTDIR}" -type l | + while read ; do + _r="$(readlink -f "${REPLY}")" + + einfo "Removing ${_r}" + rm -f "${_r}" + done + fi + + if [[ -n "${EGIT_DIR}" ]] ; then + if [[ -d "${EGIT_DIR}" ]] ; then + einfo "Removing ${EGIT_DIR}" + rm -rf "${EGIT_DIR}" + fi + + if [[ -d "${EGIT3_STORE_DIR}" ]] ; then + find "${EGIT3_STORE_DIR}" -mindepth 0 -type d -empty | + while read ; do + einfo "Removing ${REPLY}" + rm -rf "${REPLY}" + done + fi + fi +} + function post_src_install () { if [[ ${ED} ]] ; then local _ed="${ED}" @@ -315,4 +350,8 @@ function pre_pkg_preinst () { __restore_bash_options } +function post_pkg_postinst () { + __drop-distfiles +} + # vim: syntax=sh |