diff options
author | Bertrand Jacquin <bertrand@jacquin.bzh> | 2019-05-13 21:20:25 +0100 |
---|---|---|
committer | Bertrand Jacquin <bertrand@jacquin.bzh> | 2019-05-20 18:43:52 +0100 |
commit | 7067e437faab2aaf6a6a9f0d2360aa17d73f2612 (patch) | |
tree | 3dbf36a9ff3cc5a69bc430532992a5d0423f812f /profiles/common | |
parent | profiles/raspberry-pi: Enable savedconfig USE flag for sys-kernel/linux-firmware (diff) | |
download | portage-7067e437faab2aaf6a6a9f0d2360aa17d73f2612.tar.xz |
profiles/common: drop distfiles after install
Diffstat (limited to 'profiles/common')
-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 |