diff options
author | Markus Duft <mduft@gentoo.org> | 2010-10-29 07:01:08 +0000 |
---|---|---|
committer | Markus Duft <mduft@gentoo.org> | 2010-10-29 07:01:08 +0000 |
commit | efec708f2a4745acdda984ce1034384a42baca58 (patch) | |
tree | e98539150911ebf734a5ef2a0172a8f34d96215c | |
parent | Stable for HPPA (bug #338510). (diff) | |
download | historical-efec708f2a4745acdda984ce1034384a42baca58.tar.gz historical-efec708f2a4745acdda984ce1034384a42baca58.tar.bz2 historical-efec708f2a4745acdda984ce1034384a42baca58.zip |
merge changes from prefix-tree, thanks radhermit for the review.
-rw-r--r-- | eclass/vim-plugin.eclass | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass index 85b94dd8078b..67cc99b7a8a9 100644 --- a/eclass/vim-plugin.eclass +++ b/eclass/vim-plugin.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.24 2010/10/29 06:44:06 mduft Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/vim-plugin.eclass,v 1.25 2010/10/29 07:01:08 mduft Exp $ # # This eclass simplifies installation of app-vim plugins into # /usr/share/vim/vimfiles. This is a version-independent directory @@ -20,36 +20,22 @@ SRC_URI="mirror://gentoo/${P}.tar.bz2" SLOT="0" vim-plugin_src_install() { - has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}" - + has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" local f - local _portage_user='portage' - local _portage_group='portage' - local _root=root - local _group=wheel - - # no wheel group here. - if use userland_BSD || use userland_Darwin; then - _group=root - fi - # in prefix, we don't want to give away rights to root - if use prefix; then - _portage_user=${PORTAGE_USER} - _portage_group=${PORTAGE_GROUP} - _root=${PORTAGE_ROOT_USER} - _group=${_portage_group} + if use !prefix || [[ ${EUID} -eq 0 ]] ; then + ebegin "Fixing file permissions" + # Make sure perms are good + chmod -R a+rX "${S}" || die "chmod failed" + find "${S}" -user 'portage' -exec chown root '{}' \; || die "chown failed" + if use userland_BSD || [[ ${CHOST} == *-darwin* ]] ; then + find "${S}" -group 'portage' -exec chgrp wheel '{}' \; || die "chgrp failed" + else + find "${S}" -group 'portage' -exec chgrp root '{}' \; || die "chgrp failed" + fi + eend $? fi - ebegin "Fixing file permissions" - # Make sure perms are good - chmod -R a+rX "${S}" || die "chmod failed" - [[ ${_portage} != ${_root} ]] && \ - find "${S}" -user ${_portage_user} -exec chown ${_root} '{}' \; || die "chown failed" - [[ ${_portage} != ${_group} ]] && \ - find "${S}" -group ${_portage_group} -exec chgrp ${_group} '{}' \; || die "chgrp failed" - eend $? - # Install non-vim-help-docs cd "${S}" for f in *; do @@ -78,25 +64,27 @@ vim-plugin_pkg_postinst() { } vim-plugin_pkg_postrm() { + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= update_vim_helptags # from vim-doc update_vim_afterscripts # see below # Remove empty dirs; this allows # /usr/share/vim to be removed if vim-core is unmerged - find /usr/share/vim/vimfiles -depth -type d -exec rmdir {} \; 2>/dev/null + find "${EPREFIX}/usr/share/vim/vimfiles" -depth -type d -exec rmdir {} \; 2>/dev/null } # update_vim_afterscripts: create scripts in # /usr/share/vim/vimfiles/after/* comprised of the snippets in # /usr/share/vim/vimfiles/after/*/*.d update_vim_afterscripts() { - has "${EAPI:-0}" 0 1 2 && use !prefix && EROOT="${ROOT}" + has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" + has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after # Nothing to do if the dir isn't there [ -d "${afterdir}" ] || return 0 - einfo "Updating scripts in /usr/share/vim/vimfiles/after" + einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after" find "${afterdir}" -type d -name \*.vim.d | \ while read d; do echo '" Generated by update_vim_afterscripts' > "${d%.d}" @@ -104,7 +92,7 @@ update_vim_afterscripts() { sort -z | xargs -0 cat >> "${d%.d}" done - einfo "Removing dead scripts in /usr/share/vim/vimfiles/after" + einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after" find "${afterdir}" -type f -name \*.vim | \ while read f; do [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \ |