--- baselayout-2.2.ebuild +++ baselayout-2.2.ebuild @@ -2,6 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-2.2.ebuild,v 1.17 2014/01/18 09:05:09 vapier Exp $ +EAPI=5 + inherit eutils multilib DESCRIPTION="Filesystem baselayout and init scripts" @@ -40,7 +42,7 @@ multilib_layout() { local dirs syms exp d for libdir in ${libdirs} ; do exp=( {,usr/,usr/local/}${libdir} ) - for d in "${exp[@]/#/${ROOT}}" ; do + for d in "${exp[@]/#/${EROOT}}" ; do # most things should be dirs if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then [ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}" @@ -62,7 +64,7 @@ multilib_layout() { # setup symlinks and dirs where we expect them to be; do not migrate # data ... just fall over in that case. local prefix - for prefix in "${ROOT}"{,usr/,usr/local/} ; do + for prefix in "${EROOT}"{,usr/,usr/local/} ; do if [ "${SYMLINK_LIB}" = yes ] ; then # we need to make sure "lib" points to the native libdir if [ -h "${prefix}lib" ] ; then @@ -130,34 +132,24 @@ pkg_preinst() { # /etc/conf.d into ${D}, it makes them all appear to be the default # versions. In order to protect them from being unmerged after this # upgrade, modify their timestamps. - touch "${ROOT}"/etc/conf.d/* 2>/dev/null + touch "${EROOT}"/etc/conf.d/* 2>/dev/null # This is written in src_install (so it's in CONTENTS), but punt all # pending updates to avoid user having to do etc-update (and make the # pkg_postinst logic simpler). - rm -f "${ROOT}"/etc/._cfg????_gentoo-release + rm -f "${EROOT}"/etc/._cfg????_gentoo-release # We need to install directories and maybe some dev nodes when building # stages, but they cannot be in CONTENTS. # Also, we cannot reference $S as binpkg will break so we do this. multilib_layout if use build ; then - emake -C "${D}/usr/share/${PN}" DESTDIR="${ROOT}" layout || die + emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout || die fi - rm -f "${D}"/usr/share/${PN}/Makefile + rm -f "${ED}"/usr/share/${PN}/Makefile } -src_install() { - emake \ - OS=$(usex kernel_FreeBSD BSD Linux) \ - DESTDIR="${D}" \ - install || die - dodoc ChangeLog.svn - - # need the makefile in pkg_preinst - insinto /usr/share/${PN} - doins Makefile || die - +src_prepare() { # handle multilib paths. do it here because we want this behavior # regardless of the C library that you're using. we do explicitly # list paths which the native ldconfig searches, but this isn't @@ -166,12 +158,25 @@ src_install() { # path and the symlinked path doesn't change the resulting cache. local libdir ldpaths for libdir in $(get_all_libdirs) ; do - ldpaths+=":/${libdir}:/usr/${libdir}:/usr/local/${libdir}" + ldpaths+=":${EPREFIX}/${libdir}:${EPREFIX}/usr/${libdir}" + ldpaths+=":${EPREFIX}/usr/local/${libdir}" done - echo "LDPATH='${ldpaths#:}'" >> "${D}"/etc/env.d/00basic + echo "LDPATH='${ldpaths#:}'" >> etc/env.d/00basic # rc-scripts version for testing of features that *should* be present - echo "Gentoo Base System release ${PV}" > "${D}"/etc/gentoo-release + echo "Gentoo Base System release ${PV}" > etc/gentoo-release +} + +src_install() { + emake \ + OS=$(usex kernel_FreeBSD BSD Linux) \ + DESTDIR="${ED}" \ + install + dodoc ChangeLog.svn + + # need the makefile in pkg_preinst + insinto /usr/share/${PN} + doins Makefile } pkg_postinst() { @@ -183,24 +188,24 @@ pkg_postinst() { # (3) accidentally packaging up personal files with quickpkg # If they don't exist then we install them for x in master.passwd passwd shadow group fstab ; do - [ -e "${ROOT}etc/${x}" ] && continue - [ -e "${ROOT}usr/share/baselayout/${x}" ] || continue - cp -p "${ROOT}usr/share/baselayout/${x}" "${ROOT}"etc + [ -e "${EROOT}etc/${x}" ] && continue + [ -e "${EROOT}usr/share/baselayout/${x}" ] || continue + cp -p "${EROOT}usr/share/baselayout/${x}" "${EROOT}"etc done # Force shadow permissions to not be world-readable #260993 for x in shadow ; do - [ -e "${ROOT}etc/${x}" ] && chmod o-rwx "${ROOT}etc/${x}" + [ -e "${EROOT}etc/${x}" ] && chmod o-rwx "${EROOT}etc/${x}" done # Take care of the etc-update for the user - if [ -e "${ROOT}"/etc/._cfg0000_gentoo-release ] ; then - mv "${ROOT}"/etc/._cfg0000_gentoo-release "${ROOT}"/etc/gentoo-release + if [ -e "${EROOT}"etc/._cfg0000_gentoo-release ] ; then + mv "${EROOT}"etc/._cfg0000_gentoo-release "${EROOT}"etc/gentoo-release fi # whine about users that lack passwords #193541 - if [[ -e ${ROOT}/etc/shadow ]] ; then - local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${ROOT}"/etc/shadow) + if [[ -e "${EROOT}"etc/shadow ]] ; then + local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow) if [[ -n ${bad_users} ]] ; then echo ewarn "The following users lack passwords!" @@ -209,12 +214,12 @@ pkg_postinst() { fi # baselayout leaves behind a lot of .keep files, so let's clean them up - find "${ROOT}"/lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null - find "${ROOT}"/lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null + find "${EROOT}"lib*/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null + find "${EROOT}"lib*/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null # whine about users with invalid shells #215698 - if [[ -e ${ROOT}/etc/passwd ]] ; then - local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' /etc/passwd | sort) + if [[ -e "${EROOT}"etc/passwd ]] ; then + local bad_shells=$(awk -F: 'system("test -e " $7) { print $1 " - " $7}' "${EROOT}"etc/passwd | sort) if [[ -n ${bad_shells} ]] ; then echo ewarn "The following users have non-existent shells!" @@ -224,9 +229,9 @@ pkg_postinst() { # http://bugs.gentoo.org/361349 if use kernel_linux; then - mkdir -p "${ROOT}"/run + mkdir -p "${EROOT}"run - if ! grep -qs "^tmpfs.*/run " "${ROOT}"/proc/mounts ; then + if ! grep -qs "^tmpfs.*/run " "${ROOT}"proc/mounts ; then echo ewarn "You should reboot the system now to get /run mounted with tmpfs!" fi