diff options
-rw-r--r-- | profiles/common/profile.bashrc | 58 |
1 files changed, 36 insertions, 22 deletions
diff --git a/profiles/common/profile.bashrc b/profiles/common/profile.bashrc index 3f7c2ecd..3b531bc5 100644 --- a/profiles/common/profile.bashrc +++ b/profiles/common/profile.bashrc @@ -4,27 +4,27 @@ function __drop-nls-man-pages () { return 0 fi - if [[ ! -d "${ED}/usr/share/man" ]] ; then + if [[ ! -d "${_ed}/usr/share/man" ]] ; then return 0 fi - find "${ED}/usr/share/man" \ + find "${_ed}/usr/share/man" \ -mindepth 1 -maxdepth 1 \ -type d \ -name 'man*' -prune -o -print | sort | while read ; do - einfo "Removing ${REPLY#${ED}}" + einfo "Removing ${REPLY#${_ed}}" rm -rf "${REPLY}" done } function __drop-nls-locales () { - if [[ ! -d "${ED}/usr/share/locale" ]] ; then + if [[ ! -d "${_ed}/usr/share/locale" ]] ; then return 0 fi - find "${ED}/usr/share/locale" \ + find "${_ed}/usr/share/locale" \ -mindepth 1 -maxdepth 1 \ -type d | sort | @@ -33,7 +33,7 @@ function __drop-nls-locales () { continue fi - einfo "Removing ${REPLY#${ED}}" + einfo "Removing ${REPLY#${_ed}}" rm -rf "${REPLY}" done } @@ -51,12 +51,12 @@ function __drop-doc () { local _dir for _dir in "${_DIRS[@]}" ; do - if [[ ! -d "${ED}/${_dir}" ]] ; then + if [[ ! -d "${_ed}/${_dir}" ]] ; then continue fi einfo "Removing ${_dir}" - rm -rf "${ED}/${_dir}" + rm -rf "${_ed}/${_dir}" done } @@ -68,12 +68,12 @@ function __drop-unneeded () { local _path for _path in "${_PATH[@]}" ; do - if [[ ! -e "${ED}/${_path}" ]] ; then + if [[ ! -e "${_ed}/${_path}" ]] ; then continue fi einfo "Removing ${_path}" - rm -rf "${ED}/${_path}" + rm -rf "${_ed}/${_path}" done } @@ -81,14 +81,14 @@ function __drop-empty-dir () { local i while (( i++ < 64 )) && - [[ $(find "${ED}" -mindepth 1 -type d -empty) ]] ; do - find "${ED}/" \ + [[ $(find "${_ed}" -mindepth 1 -type d -empty) ]] ; do + find "${_ed}" \ -mindepth 1 \ -type d \ -empty | sort | while read ; do - einfo "Removing ${REPLY#${ED}}" + einfo "Removing ${REPLY#${_ed}}" rm -rf "${REPLY}" done done @@ -122,36 +122,50 @@ function __install_own_file () { -printf '%P\n' | sort | while read ; do - if [[ -e "${ED}/${REPLY}" ]] ; then + if [[ -e "${_ed}/${REPLY}" ]] ; then einfo "Store original ${REPLY} to /usr/share/gentoo-factory/${CATEGORY}/${PF}" install -D -m 0644 \ - "${ED}/${REPLY}" \ - "${ED}/usr/share/gentoo-factory/${CATEGORY}/${PF}/${REPLY}" \ + "${_ed}/${REPLY}" \ + "${_ed}/usr/share/gentoo-factory/${CATEGORY}/${PF}/${REPLY}" \ || die fi einfo "Install ${REPLY} from factory-default" install -D -m 0644 \ "${_FACTORY_DIRECTORY}/${REPLY}" \ - "${ED}/${REPLY}" \ + "${_ed}/${REPLY}" \ || die done } function post_src_install () { - if [[ ! ${ED} ]] ; then - local ED="${D}" + if [[ ${ED} ]] ; then + local _ed="${ED}" + else + local _ed="${D}" + fi + + # Get ride of trailing / + local _ed="${_ed/%\/}" + + if [[ ! -d "${_ed}" ]] ; then + return 0 fi __install_own_file } function pre_pkg_preinst () { - if [[ ! ${ED} ]] ; then - local ED="${D}" + if [[ ${ED} ]] ; then + local _ed="${ED}" + else + local _ed="${D}" fi - if [[ ! -d "${ED}" ]] ; then + # Get ride of trailing / + local _ed="${_ed/%\/}" + + if [[ ! -d "${_ed}" ]] ; then return 0 fi |