summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-apps/baselayout-prefix
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-apps/baselayout-prefix')
-rw-r--r--sys-apps/baselayout-prefix/Manifest4
-rw-r--r--sys-apps/baselayout-prefix/baselayout-prefix-1.12.14-r1.ebuild148
-rw-r--r--sys-apps/baselayout-prefix/baselayout-prefix-1.12.14.ebuild182
-rw-r--r--sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r11.ebuild180
-rw-r--r--sys-apps/baselayout-prefix/baselayout-prefix-2.2-r3.ebuild96
-rw-r--r--sys-apps/baselayout-prefix/baselayout-prefix-2.2-r4.ebuild84
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-aix.patch110
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-darwin-kvm.patch22
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-gnulib.patch78
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-bash.patch18
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-eprefix.patch25
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch16
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-prompt.patch58
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-recursion.patch33
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining.patch83
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-no-consoletype.patch11
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-pidof.patch11
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-sh.patch226
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-src.patch102
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix.patch409
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-solaris.patch66
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-strsep.patch42
-rw-r--r--sys-apps/baselayout-prefix/files/baselayout-1.12.5-termios_h.patch30
-rw-r--r--sys-apps/baselayout-prefix/files/einfo-1.0.4-termcap-check.patch83
-rw-r--r--sys-apps/baselayout-prefix/metadata.xml10
25 files changed, 2127 insertions, 0 deletions
diff --git a/sys-apps/baselayout-prefix/Manifest b/sys-apps/baselayout-prefix/Manifest
new file mode 100644
index 000000000000..44b3a225d84c
--- /dev/null
+++ b/sys-apps/baselayout-prefix/Manifest
@@ -0,0 +1,4 @@
+DIST baselayout-2.2.tar.bz2 40744 SHA256 11d4a223b06da545c3e59e07c9195570f334b5b1be05d995df0ebc8ea2203e98 SHA512 a5199c42e835d9f2683cc94f3c4c47ecdc392316c24e0932845736e2e90479b0c5c8ad72ead8e0537f097405b7d7548d00b87b7ff8c9e3651486e3c5c0970b36 WHIRLPOOL 60cc4f7f76c5a45c15303e526decffb3bad2b50ac659b1dd072d2ed4b0eb0b31929a1a733ddb03a31ee5882b889a4efb87206f63ffaa2b11e26d36afd0933a95
+DIST baselayout-prefix-1.12.14.1709.tar.bz2 461562 SHA256 ca1eec028b7ec72f1e3196f71eafd564062d9b677569698fe41ac5f817c9379e SHA512 600cf1a90771deb0f1d2be73dc2b6fbd0708c8b19e4b300a95cb5e5431be05904864cbcf8cd87dd3aefa5827fc8c3324d5249496a37a84ea2f676a25447f5b9e WHIRLPOOL 872f02fa0e4920c1c6fadbfeeee19d52ab1a2ccce32b0eb52e245dc71767cf31110c063946163bc171d6085a50867f74936c397fd6fdf8e9e30b146b06dc8926
+DIST baselayout-prefix-1.12.5.1701.tar.bz2 412843 SHA256 452ee800e37c65d9c44e77130f0ea9f082e05df2f9a673523fe2e03170fa3099 SHA512 87d73943a9210c2ab613a60bed1197fa92fe536bde870f97e28aaa6cbc432d2c94b507f9a78011c2b7e92a09612267c3d23a540bdb5677a836d6dc845af0858b WHIRLPOOL 4a678f1b150a48c85507a09dce57572b98eb7f2c4e22bb57294cc653e7ac896281ed255f39ecc6c45e3a1ddd385ffded1eaec9b3b0412b62320f0e997e8a84ec
+DIST einfo-1.0.6.tar.xz 222368 SHA256 036108a6160c0a5468483e94effc2665d2028b6c64ea22ec607117cbaec564d6 SHA512 d9fabb11621b3ab49aaa0ad318ee6f511ee09d2a4de1cce7da1c3e0b1f8cb9a3b2f5d446f7e6d7b662a21955178ed89cc4c212382aac66d40a774f42f9a53738 WHIRLPOOL ec7bd03ac6f10205f8405fa0c4907af748a95727bb0a3fa20024a5fd215cb19e9eeebabcdba4be4710962d170bd96c47e03258e0f5b03e98449c90a32d0dedf0
diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-1.12.14-r1.ebuild b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.14-r1.ebuild
new file mode 100644
index 000000000000..2dc3eefcaeac
--- /dev/null
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.14-r1.ebuild
@@ -0,0 +1,148 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils toolchain-funcs multilib prefix flag-o-matic user
+
+# last part in e.g. 1.12.14.1704
+PVER=1709
+
+DESCRIPTION="Baselayout for Gentoo Prefix installs"
+HOMEPAGE="http://prefix.gentoo.org/"
+SRC_URI="http://dev.gentoo.org/~grobian/distfiles/${P}.${PVER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="prefix-chaining"
+DEPEND=">=sys-apps/portage-2.2.01"
+RDEPEND=">=sys-libs/readline-5.0-r1
+ >=app-shells/bash-3.1_p7
+ >=sys-apps/coreutils-5.2.1
+ kernel_Darwin? ( sys-process/pidof-bsd )
+ kernel_FreeBSD? ( sys-process/pidof-bsd )"
+
+S=${WORKDIR}/${P}.${PVER}
+
+src_prepare() {
+ if use prefix-chaining; then
+ epatch "${S}"/baselayout-${PV}-prefix-chaining.patch
+
+ # need to set the PKG_CONFIG_PATH globally for this prefix, when
+ # chaining is enabled, since pkg-config may not be installed locally,
+ # but still .pc files should be found for all RDEPENDable prefixes in
+ # the chain.
+ echo "PKG_CONFIG_PATH=\"${EPREFIX}/usr/lib/pkgconfig:${EPREFIX}/usr/share/pkgconfig\"" >> "${S}"/etc/env.d/00basic
+ fi
+
+ cd "${S}"
+ eprefixify \
+ etc/env.d/00basic \
+ etc/profile
+
+ # add the host OS MANPATH
+ echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
+
+ # avoid a re-automake run
+ touch -r gnulib/configure.ac gnulib/Makefile.in gnulib/aclocal.m4 || die
+}
+
+src_configure() {
+ cd gnulib || die
+ default
+}
+
+src_compile() {
+ # build gnulib first
+ pushd gnulib > /dev/null || die
+ emake || die "Cannot build gnulib"
+ popd > /dev/null
+
+ # use gnulib (buildsystem doesn't respect cppflags)
+ append-cflags -I../gnulib -I../gnulib/gllib
+ append-ldflags -L../gnulib/gllib
+ append-libs gnu
+
+ local libdir="lib"
+
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+}
+
+src_install() {
+ local dir libdirs libdirs_env rcscripts_dir
+
+ dodir /etc
+ dodir /etc/env.d
+ dodir /etc/init.d # .keep file might mess up init.d stuff
+
+ libdirs=$(get_all_libdirs)
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+
+ rcscripts_dir="/lib/rcscripts"
+
+ for dir in ${libdirs}; do
+ libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
+ [[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
+ dodir /"${dir}"
+ dodir /usr/"${dir}"
+ dodir /usr/local/"${dir}"
+ done
+
+ # Ugly compatibility with stupid ebuilds and old profiles symlinks
+ if [[ ${SYMLINK_LIB} == "yes" ]] ; then
+ rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
+ fi
+
+ # FHS compatibility symlinks stuff
+ dosym /var/tmp /usr/tmp
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Prefix Base System version ${PV}" > ${ED}/etc/gentoo-release
+
+ # get the basic stuff in there
+ doenvd "${S}"/etc/env.d/* || die "doenvd"
+
+ # copy the profile
+ cp "${S}"/etc/profile "${ED}"/etc/profile
+
+ # Setup files in /sbin
+ #
+ cd "${S}"/sbin
+ into /
+ # These moved from /etc/init.d/ to /sbin to help newb systems
+ # from breaking
+
+ #
+ # Install baselayout utilities
+ #
+ local libdir="lib"
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+}
+
+pkg_postinst() {
+ if [[ ${EUID} == 0 ]] ; then
+ # setup portage user, such that things that require root privs
+ # don't fail, bug #321623
+ enewgroup portage 250
+ enewuser portage 250 -1 "${EPREFIX}"/var/tmp/portage portage
+ fi
+
+ # This is also written in src_install (so it's in CONTENTS), but
+ # write it here so that the new version is immediately in the file
+ # (without waiting for the user to do etc-update)
+ rm -f "${EROOT}"/etc/._cfg????_gentoo-release
+ echo "Gentoo Prefix Base System version ${PV}" > "${EROOT}"/etc/gentoo-release
+
+ echo
+ einfo "Please be sure to update all pending '._cfg*' files in /etc,"
+ einfo "else things might break! You can use 'etc-update'"
+ einfo "to accomplish this:"
+ einfo
+ einfo " # etc-update"
+ echo
+}
diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-1.12.14.ebuild b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.14.ebuild
new file mode 100644
index 000000000000..ac709afaae54
--- /dev/null
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.14.ebuild
@@ -0,0 +1,182 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils toolchain-funcs multilib prefix flag-o-matic user
+
+# last part in e.g. 1.12.14.1704
+PVER=1709
+
+DESCRIPTION="Baselayout for Gentoo Prefix installs"
+HOMEPAGE="http://prefix.gentoo.org/"
+SRC_URI="http://dev.gentoo.org/~grobian/distfiles/${P}.${PVER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="prefix-chaining"
+DEPEND=">=sys-apps/portage-2.2.01"
+RDEPEND=">=sys-libs/readline-5.0-r1
+ >=app-shells/bash-3.1_p7
+ >=sys-apps/coreutils-5.2.1
+ kernel_Darwin? ( sys-process/pidof-bsd )
+ kernel_FreeBSD? ( sys-process/pidof-bsd )"
+
+S=${WORKDIR}/${P}.${PVER}
+
+src_prepare() {
+ if use prefix-chaining; then
+ epatch "${S}"/baselayout-${PV}-prefix-chaining.patch
+
+ # need to set the PKG_CONFIG_PATH globally for this prefix, when
+ # chaining is enabled, since pkg-config may not be installed locally,
+ # but still .pc files should be found for all RDEPENDable prefixes in
+ # the chain.
+ echo "PKG_CONFIG_PATH=\"${EPREFIX}/usr/lib/pkgconfig:${EPREFIX}/usr/share/pkgconfig\"" >> "${S}"/etc/env.d/00basic
+ fi
+
+ # The consoletype application in this form will only work on Linux
+ [[ ${CHOST} == *-linux-* ]] || epatch "${FILESDIR}"/baselayout-1.12.5-prefix-no-consoletype.patch
+
+ cd "${S}"
+ eprefixify \
+ etc/env.d/00basic \
+ etc/profile \
+ sbin/functions.sh \
+ sbin/runscript.sh \
+ src/runscript.c \
+ sbin/depscan.sh \
+ sbin/rc-daemon.sh \
+ sbin/rc-services.sh
+ # add the host OS MANPATH
+ echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
+
+ # avoid a re-automake run
+ touch -r gnulib/configure.ac gnulib/Makefile.in gnulib/aclocal.m4 || die
+}
+
+src_configure() {
+ cd gnulib || die
+ default
+}
+
+src_compile() {
+ # build gnulib first
+ pushd gnulib > /dev/null || die
+ emake || die "Cannot build gnulib"
+ popd > /dev/null
+
+ # use gnulib (buildsystem doesn't respect cppflags)
+ append-cflags -I../gnulib -I../gnulib/gllib
+ append-ldflags -L../gnulib/gllib
+ append-libs gnu
+
+ local libdir="lib"
+
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ # CFLAGS in LD for #370695
+ make -C "${S}"/src \
+ CC="$(tc-getCC)" \
+ LD="$(tc-getCC) ${CFLAGS} ${LDFLAGS}" \
+ CFLAGS="${CFLAGS}" \
+ LIBDIR="${libdir}" || die
+}
+
+src_install() {
+ local dir libdirs libdirs_env rcscripts_dir
+
+ dodir /etc
+ dodir /etc/env.d
+ dodir /etc/init.d # .keep file might mess up init.d stuff
+
+ libdirs=$(get_all_libdirs)
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+
+ rcscripts_dir="/lib/rcscripts"
+
+ for dir in ${libdirs}; do
+ libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
+ [[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
+ dodir /"${dir}"
+ dodir /usr/"${dir}"
+ dodir /usr/local/"${dir}"
+ done
+
+ # Ugly compatibility with stupid ebuilds and old profiles symlinks
+ if [[ ${SYMLINK_LIB} == "yes" ]] ; then
+ rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
+ fi
+
+ # FHS compatibility symlinks stuff
+ dosym /var/tmp /usr/tmp
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Prefix Base System version ${PV}" > ${ED}/etc/gentoo-release
+
+ # get the basic stuff in there
+ doenvd "${S}"/etc/env.d/* || die "doenvd"
+
+ # copy the profile
+ cp "${S}"/etc/profile "${ED}"/etc/profile
+
+ # Setup files in /sbin
+ #
+ cd "${S}"/sbin
+ into /
+ # These moved from /etc/init.d/ to /sbin to help newb systems
+ # from breaking
+ dosbin runscript.sh functions.sh
+
+ # Compat symlinks between /etc/init.d and /sbin
+ # (some stuff have hardcoded paths)
+ dosym ../../sbin/depscan.sh /etc/init.d/depscan.sh
+ dosym ../../sbin/runscript.sh /etc/init.d/runscript.sh
+ dosym ../../sbin/functions.sh /etc/init.d/functions.sh
+
+ cd "${S}"/sbin
+ into /
+ dosbin depscan.sh
+ insinto ${rcscripts_dir}/awk
+ doins "${S}"/src/awk/functions.awk
+
+ #
+ # Install baselayout utilities
+ #
+ local libdir="lib"
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ cd "${S}"/src
+ make DESTDIR="${ED}" LIBDIR="${libdir}" install || die
+
+ insinto ${rcscripts_dir}/sh
+ doins "${S}"/sbin/rc-*
+}
+
+pkg_postinst() {
+ if [[ ${EUID} == 0 ]] ; then
+ # setup portage user, such that things that require root privs
+ # don't fail, bug #321623
+ enewgroup portage 250
+ enewuser portage 250 -1 "${EPREFIX}"/var/tmp/portage portage
+ fi
+
+ # This is also written in src_install (so it's in CONTENTS), but
+ # write it here so that the new version is immediately in the file
+ # (without waiting for the user to do etc-update)
+ rm -f "${EROOT}"/etc/._cfg????_gentoo-release
+ echo "Gentoo Prefix Base System version ${PV}" > "${EROOT}"/etc/gentoo-release
+
+ echo
+ einfo "Please be sure to update all pending '._cfg*' files in /etc,"
+ einfo "else things might break! You can use 'etc-update'"
+ einfo "to accomplish this:"
+ einfo
+ einfo " # etc-update"
+ echo
+}
diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r11.ebuild b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r11.ebuild
new file mode 100644
index 000000000000..165cf8908786
--- /dev/null
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r11.ebuild
@@ -0,0 +1,180 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils toolchain-funcs multilib prefix flag-o-matic user
+
+# baselayout-prefix-1.12.5.1694.tar.bz2
+PVER=1701
+
+DESCRIPTION="Baselayout for Gentoo Prefix installs"
+HOMEPAGE="http://prefix.gentoo.org/"
+SRC_URI="http://dev.gentoo.org/~grobian/distfiles/${P}.${PVER}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="prefix-chaining"
+DEPEND=">=sys-apps/portage-2.2.01"
+RDEPEND=">=sys-libs/readline-5.0-r1
+ >=app-shells/bash-3.1_p7
+ >=sys-apps/coreutils-5.2.1
+ kernel_Darwin? ( sys-process/pidof-bsd )
+ kernel_FreeBSD? ( sys-process/pidof-bsd )"
+
+S=${WORKDIR}/${P}.${PVER}
+
+src_prepare() {
+ if use prefix-chaining; then
+ epatch "${S}"/baselayout-1.12.5-prefix-chaining.patch
+
+ # need to set the PKG_CONFIG_PATH globally for this prefix, when
+ # chaining is enabled, since pkg-config may not be installed locally,
+ # but still .pc files should be found for all RDEPENDable prefixes in
+ # the chain.
+ echo "PKG_CONFIG_PATH=\"${EPREFIX}/usr/lib/pkgconfig:${EPREFIX}/usr/share/pkgconfig\"" >> "${S}"/etc/env.d/00basic
+ fi
+
+ # The consoletype application in this form will only work on Linux
+ [[ ${CHOST} == *-linux-* ]] || epatch "${FILESDIR}"/${P/-prefix/}-prefix-no-consoletype.patch
+
+ cd "${S}"
+ eprefixify \
+ etc/env.d/00basic \
+ etc/profile \
+ sbin/env-update.sh \
+ sbin/functions.sh \
+ sbin/runscript.sh \
+ src/runscript.c \
+ sbin/depscan.sh \
+ sbin/rc-daemon.sh \
+ sbin/rc-services.sh
+ # add the host OS MANPATH
+ echo 'MANPATH="/usr/share/man"' > etc/env.d/99basic || die "can't make file"
+}
+
+src_configure() {
+ cd gnulib || die
+ default
+}
+
+src_compile() {
+ # build gnulib first
+ pushd gnulib > /dev/null || die
+ emake || die "Cannot build gnulib"
+ popd > /dev/null
+
+ # use gnulib
+ append-flags -I../gnulib -I../gnulib/gllib
+ append-ldflags -L../gnulib/gllib
+ append-libs gnu
+
+ local libdir="lib"
+
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ make -C "${S}"/src \
+ CC="$(tc-getCC)" \
+ LD="$(tc-getCC) ${LDFLAGS}" \
+ CFLAGS="${CFLAGS}" \
+ LIBDIR="${libdir}" || die
+}
+
+src_install() {
+ local dir libdirs libdirs_env rcscripts_dir
+
+ dodir /etc
+ dodir /etc/env.d
+ dodir /etc/init.d # .keep file might mess up init.d stuff
+
+ libdirs=$(get_all_libdirs)
+ : ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
+
+ rcscripts_dir="/lib/rcscripts"
+
+ for dir in ${libdirs}; do
+ libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
+ [[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
+ dodir /"${dir}"
+ dodir /usr/"${dir}"
+ dodir /usr/local/"${dir}"
+ done
+
+ # Ugly compatibility with stupid ebuilds and old profiles symlinks
+ if [[ ${SYMLINK_LIB} == "yes" ]] ; then
+ rm -r "${ED}"/{lib,usr/lib,usr/local/lib} &> /dev/null
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
+ dosym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
+ fi
+
+ # FHS compatibility symlinks stuff
+ dosym /var/tmp /usr/tmp
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Prefix Base System version ${PV}" > ${ED}/etc/gentoo-release
+
+ # get the basic stuff in there
+ doenvd "${S}"/etc/env.d/* || die "doenvd"
+
+ # copy the profile
+ cp "${S}"/etc/profile "${ED}"/etc/profile
+
+ # Setup files in /sbin
+ #
+ cd "${S}"/sbin
+ into /
+ # These moved from /etc/init.d/ to /sbin to help newb systems
+ # from breaking
+ dosbin runscript.sh functions.sh
+
+ # Compat symlinks between /etc/init.d and /sbin
+ # (some stuff have hardcoded paths)
+ dosym ../../sbin/depscan.sh /etc/init.d/depscan.sh
+ dosym ../../sbin/runscript.sh /etc/init.d/runscript.sh
+ dosym ../../sbin/functions.sh /etc/init.d/functions.sh
+
+ cd "${S}"/sbin
+ into /
+ dosbin depscan.sh
+ dosbin env-update.sh
+ insinto ${rcscripts_dir}/awk
+ doins "${S}"/src/awk/functions.awk
+
+ #
+ # Install baselayout utilities
+ #
+ local libdir="lib"
+ [[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
+
+ cd "${S}"/src
+ make DESTDIR="${ED}" LIBDIR="${libdir}" install || die
+
+ insinto ${rcscripts_dir}/sh
+ doins "${S}"/sbin/rc-*
+}
+
+pkg_postinst() {
+ if [[ ${EUID} == 0 ]] ; then
+ # setup portage user, such that things that require root privs
+ # don't fail, bug #321623
+ enewgroup portage 250
+ enewuser portage 250 -1 "${EPREFIX}"/var/tmp/portage portage
+ fi
+
+ # This is also written in src_install (so it's in CONTENTS), but
+ # write it here so that the new version is immediately in the file
+ # (without waiting for the user to do etc-update)
+ rm -f "${EROOT}"/etc/._cfg????_gentoo-release
+ echo "Gentoo Prefix Base System version ${PV}" > "${EROOT}"/etc/gentoo-release
+
+ echo
+ einfo "Please be sure to update all pending '._cfg*' files in /etc,"
+ einfo "else things might break! You can use 'etc-update'"
+ einfo "to accomplish this:"
+ einfo
+ einfo " # etc-update"
+ echo
+}
diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r3.ebuild b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r3.ebuild
new file mode 100644
index 000000000000..bd96d0c42b87
--- /dev/null
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r3.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils multilib libtool
+
+MY_P=${P/-prefix/} # just use "upstream" sources
+EINFO=einfo-1.0.6
+DESCRIPTION="Minimal baselayout and e-functions for Gentoo Prefix installs"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${MY_P}.tar.bz2
+ http://dev.gentoo.org/~vapier/dist/${MY_P}.tar.bz2
+ http://dev.gentoo.org/~redlizard/distfiles/${EINFO}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~arm ~arm-linux ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+IUSE="build kernel_linux"
+
+S=${WORKDIR}/${EINFO}
+
+pkg_preinst() {
+ # 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 "${EROOT}"/etc/._cfg????_gentoo-release
+}
+
+src_prepare() {
+ # exotic platforms still aren't fixed in upstream libtool
+ elibtoolize
+}
+
+src_configure() {
+ econf --libexecdir="${EPREFIX}/usr/lib/einfo"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ # make functions.sh available in /etc/init.d
+ # Note: we cannot replace the symlink with a file here, or Portage will
+ # config-protect it, and etc-update can't handle symlink to file updates
+ dodir etc/init.d
+ dosym ../../usr/lib/einfo/sh/functions.sh /etc/init.d/functions.sh
+
+ pushd "${WORKDIR}"/${MY_P} > /dev/null || die
+ dodir etc
+ sed \
+ -e "/PATH=/!s:/\(etc\|usr/bin\|bin\):\"${EPREFIX}\"/\1:g" \
+ -e "/PATH=/s|\([:\"]\)/|\1${EPREFIX}/|g" \
+ -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
+ -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
+ etc/profile > "${ED}"/etc/profile || die
+ dodir etc/env.d
+ sed \
+ -e "s:/\(etc/env.d\|opt\|usr\):${EPREFIX}/\1:g" \
+ -e "/^PATH=/s|\"$|:${EPREFIX}/usr/sbin:${EPREFIX}/sbin\"|" \
+ etc/env.d/00basic > "${ED}"/etc/env.d/00basic || die
+ dodoc ChangeLog.svn
+ popd > /dev/null
+
+ # add the host OS MANPATH
+ if [[ -d "${ROOT}"/usr/share/man ]] ; then
+ echo 'MANPATH="/usr/share/man"' > "${ED}"/etc/env.d/99basic || die
+ fi
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Prefix Base System release ${PV}" > "${ED}"/etc/gentoo-release
+
+ # FHS compatibility symlinks stuff
+ dosym /var/tmp /usr/tmp
+
+ # add a dummy to avoid Portage shebang errors
+ dodir sbin
+ cat > "${ED}"/sbin/runscript <<- EOF
+ #!/bin/sh
+
+ echo "runscript not supported by Gentoo Prefix Base System release ${PV}" 1>&2
+ exit 1
+ EOF
+ chmod 755 "${ED}"/sbin/runscript || die
+}
+
+pkg_postinst() {
+ # Take care of the etc-update for the user
+ if [ -e "${EROOT}"/etc/._cfg0000_gentoo-release ] ; then
+ mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release
+ fi
+
+ # baselayout leaves behind a lot of .keep files, so let's clean them up
+ find "${EROOT}"/lib/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
+ find "${EROOT}"/lib/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
+}
diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r4.ebuild b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r4.ebuild
new file mode 100644
index 000000000000..cf4a23472751
--- /dev/null
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-2.2-r4.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=3
+
+inherit eutils multilib libtool
+
+MY_P=${P/-prefix/} # just use "upstream" sources
+DESCRIPTION="Minimal baselayout for Gentoo Prefix installs"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="mirror://gentoo/${MY_P}.tar.bz2
+ http://dev.gentoo.org/~vapier/dist/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~arm ~arm-linux ~ppc-aix ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+
+RDEPEND="sys-apps/gentoo-functions"
+DEPEND="${RDEPEND}"
+
+pkg_preinst() {
+ # 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 "${EROOT}"/etc/._cfg????_gentoo-release
+}
+
+src_install() {
+ # make functions.sh available in /etc/init.d (from gentoo-functions)
+ # Note: we cannot replace the symlink with a file here, or Portage will
+ # config-protect it, and etc-update can't handle symlink to file updates
+ dodir etc/init.d
+ dosym ../../lib/gentoo/functions.sh /etc/init.d/functions.sh
+
+ pushd "${WORKDIR}"/${MY_P} > /dev/null || die
+ dodir etc
+ sed \
+ -e "/PATH=/!s:/\(etc\|usr/bin\|bin\):\"${EPREFIX}\"/\1:g" \
+ -e "/PATH=/s|\([:\"]\)/|\1${EPREFIX}/|g" \
+ -e "/PATH=.*\/sbin/s|\"$|:/usr/sbin:/sbin\"|" \
+ -e "/PATH=.*\/bin/s|\"$|:/usr/bin:/bin\"|" \
+ etc/profile > "${ED}"/etc/profile || die
+ dodir etc/env.d
+ sed \
+ -e "s:/\(etc/env.d\|opt\|usr\):${EPREFIX}/\1:g" \
+ -e "/^PATH=/s|\"$|:${EPREFIX}/usr/sbin:${EPREFIX}/sbin\"|" \
+ etc/env.d/00basic > "${ED}"/etc/env.d/00basic || die
+ dodoc ChangeLog.svn
+ popd > /dev/null
+
+ # add the host OS MANPATH
+ if [[ -d "${ROOT}"/usr/share/man ]] ; then
+ echo 'MANPATH="/usr/share/man"' > "${ED}"/etc/env.d/99basic || die
+ fi
+
+ # rc-scripts version for testing of features that *should* be present
+ echo "Gentoo Prefix Base System release ${PV}" > "${ED}"/etc/gentoo-release
+
+ # FHS compatibility symlinks stuff
+ dosym /var/tmp /usr/tmp
+
+ # add a dummy to avoid Portage shebang errors
+ dodir sbin
+ cat > "${ED}"/sbin/runscript <<- EOF
+ #!/usr/bin/env sh
+ source "${EPREFIX}/lib/gentoo/functions.sh"
+
+ eerror "runscript not supported by Gentoo Prefix Base System release ${PV}" 1>&2
+ exit 1
+ EOF
+ chmod 755 "${ED}"/sbin/runscript || die
+}
+
+pkg_postinst() {
+ # Take care of the etc-update for the user
+ if [ -e "${EROOT}"/etc/._cfg0000_gentoo-release ] ; then
+ mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release
+ fi
+
+ # baselayout leaves behind a lot of .keep files, so let's clean them up
+ find "${EROOT}"/lib/rcscripts/ -name .keep -exec rm -f {} + 2>/dev/null
+ find "${EROOT}"/lib/rcscripts/ -depth -type d -exec rmdir {} + 2>/dev/null
+}
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-aix.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-aix.patch
new file mode 100644
index 000000000000..ebc162345a52
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-aix.patch
@@ -0,0 +1,110 @@
+W00T, AIX does have /proc filesystem - even with slightly different layout.
+
+--- src/start-stop-daemon.c
++++ src/start-stop-daemon.c
+@@ -56,6 +56,8 @@
+ # define OSNetBSD
+ #elif defined(__APPLE__)
+ # define OSDarwin
++#elif defined(_AIX)
++# define OSaix
+ #else
+ # error Unknown architecture - cannot build start-stop-daemon
+ #endif
+@@ -85,6 +87,10 @@
+ #include <sys/pstat.h>
+ #endif
+
++#if defined(OSaix)
++#include <sys/procfs.h>
++#endif
++
+ #include <errno.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -178,7 +184,7 @@
+ static void do_pidfile(const char *name);
+ static void do_stop(int signal_nr, int quietmode,
+ int *n_killed, int *n_notkilled, int retry_nr);
+-#if defined(OSLinux) || defined(OShpux)
++#if defined(OSLinux) || defined(OShpux) || defined(OSaix)
+ static int pid_is_exec(pid_t pid, const struct stat *esb);
+ #endif
+
+@@ -755,7 +761,7 @@
+ static void
+ check(pid_t pid)
+ {
+-#if defined(OSLinux) || defined(OShpux)
++#if defined(OSLinux) || defined(OShpux) || defined(OSaix)
+ if (execname && !pid_is_exec(pid, &exec_stat))
+ return;
+ #elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD) || defined(OSDarwin)
+@@ -791,7 +797,7 @@
+ /* WTA: this needs to be an autoconf check for /proc/pid existance.
+ */
+
+-#if defined(OSLinux) || defined (OSsunos) || defined(OSfreebsd)
++#if defined(OSLinux) || defined (OSsunos) || defined(OSfreebsd) || defined(OSaix)
+ static void
+ do_procinit(void)
+ {
+@@ -1059,6 +1065,58 @@
+ }
+ #endif /* OShpux */
+
++#if defined(OSaix)
++/* max possible pid (signed long) in theory:
++ * 32bit: 2147483647 (10 digits)
++ * 64bit: 9223372036854775807 (19 digits)
++ */
++static int
++pid_is_exec(pid_t pid, const struct stat *esb)
++{
++ struct stat sb;
++ char buf[40];
++
++ sprintf(buf, "/proc/%ld/object/a.out", pid);
++ if (stat(buf, &sb) != 0)
++ return 0;
++ return (sb.st_dev == esb->st_dev && sb.st_ino == esb->st_ino);
++}
++
++
++static int
++pid_is_user(pid_t pid, uid_t uid)
++{
++ struct stat sb;
++ char buf[32];
++
++ sprintf(buf, "/proc/%ld", pid);
++ if (stat(buf, &sb) != 0)
++ return 0;
++ return (sb.st_uid == uid);
++}
++
++
++static int
++pid_is_cmd(pid_t pid, const char *name)
++{
++ char buf[40];
++ FILE *f;
++ struct psinfo psi;
++ int r;
++
++ sprintf(buf, "/proc/%ld/psinfo", pid);
++ f = fopen(buf, "r");
++ if (!f)
++ return 0;
++ r = fread(&psi, sizeof(psi), 1, f);
++ fclose(f);
++ if (r != 1) {
++ return 0;
++ }
++ return strcmp(name, psi.pr_fname) == 0;
++}
++#endif /* OSaix */
++
+
+ static void
+ do_findprocs(void)
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-darwin-kvm.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-darwin-kvm.patch
new file mode 100644
index 000000000000..08668edff73e
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-darwin-kvm.patch
@@ -0,0 +1,22 @@
+http://bugs.gentoo.org/show_bug.cgi?id=360855
+
+by JTRiley
+
+--- baselayout-1.12.5/src/start-stop-daemon.c
++++ baselayout-1.12.5/src/start-stop-daemon.c
+@@ -73,10 +73,14 @@
+ #include <sys/types.h>
+
+ #include <err.h>
+-#include <kvm.h>
+ #include <limits.h>
+ #endif
+
++#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD)
++#include <kvm.h>
++#endif
++
++
+ #if defined(OShpux)
+ #include <sys/param.h>
+ #include <sys/pstat.h>
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-gnulib.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-gnulib.patch
new file mode 100644
index 000000000000..dfb64c633206
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-gnulib.patch
@@ -0,0 +1,78 @@
+Need to add libraries after object files, or solaris
+linker might not see library's symbols to be needed
+when added to LDFLAGS.
+
+Take strndup from gnulib too, this decl breaks on Linux (#361417).
+
+VERSION is defined in gnulib's config.h.
+
+--- src/Makefile.orig 2011-03-30 13:15:56 +0200
++++ src/Makefile 2011-03-30 13:16:52 +0200
+@@ -30,10 +30,10 @@
+ $(CC) $(CFLAGS) -c -o $@ $^
+
+ runscript: runscript.o rs-misc.o
+- $(LD) $(LDFLAGS) -o $@ $^ $(LDFLAGS_RS)
++ $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS_RS)
+
+ start-stop-daemon: start-stop-daemon.c
+- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDFLAGS_SSD)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(LDFLAGS_SSD)
+
+ install: $(TARGET)
+ install -m 0755 -d $(DESTDIR)/bin
+--- src/core/misc.c.orig 2011-03-31 17:46:46 +0200
++++ src/core/misc.c 2011-03-31 17:47:03 +0200
+@@ -86,31 +86,6 @@
+ return new_path;
+ }
+
+-char *strndup(const char *str, size_t size) {
+- char *new_str = NULL;
+- size_t len;
+-
+- if (NULL == str) {
+- DBG_MSG("Invalid argument passed!\n");
+- errno = EINVAL;
+- return NULL;
+- }
+-
+- /* Check lenght of str without breaching the size limit */
+- for (len = 0;(len < size) && ('\0' != str[len]);len++);
+-
+- new_str = malloc(len + 1);
+- if (NULL == new_str) {
+- DBG_MSG("Failed to allocate buffer!\n");
+- return NULL;
+- }
+-
+- /* Make sure our string is NULL terminated */
+- new_str[len] = '\0';
+-
+- return (char *)memcpy(new_str, str, len);
+-}
+-
+ char *gbasename(const char *path) {
+ char *new_path = NULL;
+
+--- src/core/misc.h.orig 2011-03-31 17:46:43 +0200
++++ src/core/misc.h 2011-03-31 18:06:58 +0200
+@@ -246,8 +246,6 @@
+ * with the malloc() call. */
+ char *strcatpaths(const char *pathname1, const char *pathname2);
+
+-/* Compat functions for GNU extensions */
+-char *strndup(const char *str, size_t size);
+ /* Same as basename(3), but do not modify path */
+ char *gbasename(const char *path);
+
+--- src/start-stop-daemon.c.orig 2011-03-31 18:11:02 +0200
++++ src/start-stop-daemon.c 2011-03-31 18:11:03 +0200
+@@ -31,6 +31,7 @@
+ *
+ */
+
++#undef VERSION
+ #define VERSION "1.13.11+gentoo"
+
+ #define NONRETURNPRINTFFORMAT(x, y) \
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-bash.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-bash.patch
new file mode 100644
index 000000000000..095ce451c048
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-bash.patch
@@ -0,0 +1,18 @@
+diff -ru baselayout-1.12.5.orig/sbin/env-update.sh baselayout-1.12.5/sbin/env-update.sh
+--- baselayout-1.12.5.orig/sbin/env-update.sh 2010-08-17 12:56:00.968746729 +0200
++++ baselayout-1.12.5/sbin/env-update.sh 2010-08-17 12:56:47.185326760 +0200
+@@ -1,4 +1,4 @@
+-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
++#! /usr/bin/env bash
+ # Copyright 1999-2004 Gentoo Foundation
+ # Distributed under the terms of the GNU General Public License v2
+
+diff -ru baselayout-1.12.5.orig/sbin/runscript.sh baselayout-1.12.5/sbin/runscript.sh
+--- baselayout-1.12.5.orig/sbin/runscript.sh 2010-08-17 12:56:00.968746729 +0200
++++ baselayout-1.12.5/sbin/runscript.sh 2010-08-17 12:56:58.362098849 +0200
+@@ -1,4 +1,4 @@
+-#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
++#! /usr/bin/env bash
+ # Copyright 1999-2006 Gentoo Foundation
+ # Distributed under the terms of the GNU General Public License v2
+
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-eprefix.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-eprefix.patch
new file mode 100644
index 000000000000..28d8039be1b7
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-eprefix.patch
@@ -0,0 +1,25 @@
+diff -ru baselayout-1.12.5.orig/etc/profile baselayout-1.12.5/etc/profile
+--- baselayout-1.12.5.orig/etc/profile 2009-11-27 15:27:58 +0100
++++ baselayout-1.12.5/etc/profile 2009-11-27 15:34:14 +0100
+@@ -137,6 +137,21 @@
+ done
+ fi
+
++#
++# final finally set EPREFIX to our prefix if we don't have a local portage. this
++# was previously done by the startprefix script, but we want to be able to start
++# this environment by simply sourcing etc/profile with the correct shell.
++#
++if [[ -z "${EPREFIX}" ]]; then
++ if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
++ export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
++ fi
++elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" ]]; then
++ echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"."
++ echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"."
++ echo " Having EPREFIX set this way will probably render this environment unusable."
++fi
++
+ unset _ro_root
+ unset _ro_deps
+ unset _ro_chained_path_vars
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch
new file mode 100644
index 000000000000..b0d7e79e26e1
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch
@@ -0,0 +1,16 @@
+diff -ru baselayout-1.12.5.orig/etc/profile baselayout-1.12.5/etc/profile
+--- baselayout-1.12.5.orig/etc/profile 2009-07-14 09:48:59 +0200
++++ baselayout-1.12.5/etc/profile 2009-07-14 09:50:48 +0200
+@@ -30,8 +30,11 @@
+ if [[ -n "${_ro_root}" ]]; then
+ _ro_chained_path_vars="PATH MANPATH"
+
+- [[ ${_ro_deps} == *RDEPEND* ]] &&
++ if [[ ${_ro_deps} == *RDEPEND* ]]; then
+ _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH"
++ else
++ unset PKG_CONFIG_PATH
++ fi
+
+ for var in ${_ro_chained_path_vars}; do
+ eval "_ro_backupenv_paths_${var}=\${${var}}"
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-prompt.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-prompt.patch
new file mode 100644
index 000000000000..eb7a4ab1ff58
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-prompt.patch
@@ -0,0 +1,58 @@
+diff -ru baselayout-1.12.5.orig/etc/profile baselayout-1.12.5/etc/profile
+--- baselayout-1.12.5.orig/etc/profile 2009-12-09 13:48:07 +0100
++++ baselayout-1.12.5/etc/profile 2009-12-09 13:54:52 +0100
+@@ -110,9 +110,34 @@
+ # it in the user's dot-files), but it shouldn't make any
+ # difference.
+ . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc
++ elif [ -n "${_ro_root}" ]; then
++ # We're in a prefix chain, but have no local bash. we rely on bash
++ # beeing there _somewhere_ in the chain, so we do not need to set
++ # PS1 explicitly.
++ if [ -z "${PS1}" ]; then
++ # try harder to find something in the parent prefix of the chain.
++ # dont bother to search multiple chain members up to the top.
++ if [ -f "${_ro_root}/etc/bash/bashrc" ]; then
++ . "${_ro_root}/etc/bash/bashrc"
++ fi
++ fi
+ else
+ PS1='\u@\h \w \$ '
+ fi
++
++ # Set the last dirpart of the current prefix somewhere
++ # in the prompt, so one immediately knows where he/she is.
++ if [ ${_ro_recursion_level} == 0 ]; then
++ # we're in the last prefix of the chain here.
++ _ro_name="@GENTOO_PORTAGE_EPREFIX@"
++ _ro_name="${_ro_name##*/}"
++
++ # use color only if the prompt already contains color escapes
++ case "${PS1}" in
++ *'\[\033['*'m\]'*) PS1="\[\033[01;36m\][${_ro_name}]\[\033[00m\] ${PS1}" ;;
++ *) PS1="[${_ro_name}] ${PS1}" ;;
++ esac
++ fi
+ else
+ # Setup a bland default prompt. Since this prompt should be useable
+ # on color and non-color terminals, as well as shells that don't
+@@ -120,6 +145,10 @@
+ PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
+ fi
+
++# when chaining prefixes, we want the prompt to be passed to the child too,
++# so we need to export it.
++export PS1
++
+ for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do
+ if [ -r "$sh" ] ; then
+ . "$sh"
+@@ -146,7 +175,7 @@
+ if [[ ! -x "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/emerge ]]; then
+ export EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+ fi
+-elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" ]]; then
++elif [[ "${EPREFIX}" != "@GENTOO_PORTAGE_EPREFIX@" && ${_ro_recursion_level} == 0 ]]; then
+ echo "WARNING: EPREFIX is set from environment to \"${EPREFIX}\"."
+ echo " You are entering the prefix \"@GENTOO_PORTAGE_EPREFIX@\"."
+ echo " Having EPREFIX set this way will probably render this environment unusable."
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-recursion.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-recursion.patch
new file mode 100644
index 000000000000..71883838e7bd
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining-recursion.patch
@@ -0,0 +1,33 @@
+diff -ru baselayout-1.12.5.orig/etc/profile baselayout-1.12.5/etc/profile
+--- baselayout-1.12.5.orig/etc/profile 2009-07-20 09:10:30 +0200
++++ baselayout-1.12.5/etc/profile 2009-07-20 09:49:01 +0200
+@@ -17,10 +17,29 @@
+ _ro_root=$(. "/tools/mduft/eprefix/preserved"/etc/make.conf && echo $READONLY_EPREFIX)
+ _ro_deps=${_ro_root#*:}
+ _ro_root=${_ro_root%:*}
++
++#
++# prevent dooming of _ro_* variables by recursing down the
++# profile chain, by backing the up, tagged by resursion depth.
++#
++
++[[ -z "${_ro_recursion_level}" ]] && _ro_recursion_level=0
++((++_ro_recursion_level))
++
++for _ro_backup_var in _ro_root _ro_deps; do
++ eval "_ro_b${_ro_recursion_level}_${_ro_backup_var}=\${${_ro_backup_var}}"
++done
++
+ if [ -n "${_ro_root}" -a -f "${_ro_root}"/etc/profile ]; then
+ . "${_ro_root}"/etc/profile
+ fi
+
++for _ro_backup_var in _ro_root _ro_deps; do
++ eval "${_ro_backup_var}=\${_ro_b${_ro_recursion_level}_${_ro_backup_var}}"
++done
++
++((--_ro_recursion_level))
++
+ #
+ # With prefix-chaining we want another set of variables that
+ # should be retained for all prefixes. for example it is ok
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining.patch
new file mode 100644
index 000000000000..f17d1bb39363
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-chaining.patch
@@ -0,0 +1,83 @@
+diff -ru baselayout-1.12.5.orig/etc/profile baselayout-1.12.5/etc/profile
+--- baselayout-1.12.5.orig/etc/profile 2009-03-24 08:18:37.000000000 +0100
++++ baselayout-1.12.5/etc/profile 2009-03-24 11:50:57.000000000 +0100
+@@ -4,6 +4,40 @@
+ # environment for login shells.
+ #
+
++#
++# for prefix-chaining, the very first thing to do is to load
++# the profiles for all chained instances above.
++#
++# TODO: is it safe in any case to shell source make.conf?
++# don't do any recursive expansion here. if the parent can
++# use READONLY_EPREFIX's, it has to have the same profile as
++# we have here, and thus it will source parents before
++# evaluating anything from itself.
++#
++_ro_root=$(. "@GENTOO_PORTAGE_EPREFIX@"/etc/make.conf && echo $READONLY_EPREFIX)
++_ro_deps=${_ro_root#*:}
++_ro_root=${_ro_root%:*}
++if [ -n "${_ro_root}" -a -f "${_ro_root}"/etc/profile ]; then
++ . "${_ro_root}"/etc/profile
++fi
++
++#
++# With prefix-chaining we want another set of variables that
++# should be retained for all prefixes. for example it is ok
++# to retain PKG_CONFIG_PATH if the parent of the chain can
++# be used to resolve RDEPEND...
++#
++if [[ -n "${_ro_root}" ]]; then
++ _ro_chained_path_vars="PATH MANPATH"
++
++ [[ ${_ro_deps} == *RDEPEND* ]] &&
++ _ro_chained_path_vars="${_ro_chained_path_vars} PKG_CONFIG_PATH"
++
++ for var in ${_ro_chained_path_vars}; do
++ eval "_ro_backupenv_paths_${var}=\${${var}}"
++ done
++fi
++
+ # Load environment settings from profile.env, which is created by
+ # env-update from the files in /etc/env.d
+ if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then
+@@ -21,10 +55,17 @@
+ # It is intentional in the following line to use || instead of -o.
+ # This way the evaluation can be short-circuited and calling whoami is
+ # avoided.
++#
++# system directories are only appended if this prefix is the last
++# one in a chain of prefixes (or the only prefix in the chain), so
++# that they don't end up in the middle of multiple different prefix
++# paths (profile is recursive now, see above!)
+ if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
+- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin"
++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}"
++ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/sbin:/usr/bin:/sbin:/bin"
+ else
+- PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin"
++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}"
++ [[ -z "${_ro_root}" ]] && PATH="$PATH:/usr/bin:/bin"
+ fi
+ export PATH
+ unset ROOTPATH
+@@ -63,3 +104,18 @@
+ fi
+ done
+ unset sh
++
++#
++# finally chain the save variables for previous prefixes in the chain.
++#
++if [[ -n "${_ro_chained_path_vars}" ]]; then
++ for var in ${_ro_chained_path_vars}; do
++ eval "export ${var}=\${${var}}:\${_ro_backupenv_paths_${var}}"
++ eval "unset _ro_backupenv_paths_${var}"
++ done
++fi
++
++unset _ro_root
++unset _ro_deps
++unset _ro_chained_path_vars
++
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-no-consoletype.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-no-consoletype.patch
new file mode 100644
index 000000000000..442dea3543ed
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-no-consoletype.patch
@@ -0,0 +1,11 @@
+--- baselayout-1.12.5/src/Makefile 2007-10-17 21:22:08 +0400
++++ baselayout-1.12.5/src/Makefile 2007-10-17 21:22:23 +0400
+@@ -9,7 +9,7 @@
+ LIBDIR = lib
+
+ BIN_TARGETS =
+-SBIN_TARGETS = consoletype runscript start-stop-daemon
++SBIN_TARGETS = runscript start-stop-daemon
+ SYS_WHITELIST = env_whitelist
+
+ TARGET = $(BIN_TARGETS) $(SBIN_TARGETS)
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-pidof.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-pidof.patch
new file mode 100644
index 000000000000..0a592cc59494
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-pidof.patch
@@ -0,0 +1,11 @@
+--- baselayout-1.12.5/sbin/rc-daemon.sh 2007-10-18 19:15:34 +0400
++++ baselayout-1.12.5/sbin/rc-daemon.sh 2007-10-18 19:20:32 +0400
+@@ -186,7 +186,7 @@
+ args="${args} '"${arg}"'"
+ done
+
+- eval /bin/pidof -x ${args}
++ eval @GENTOO_PORTAGE_EPREFIX@/bin/pidof -x ${args}
+ }
+
+ # bool is_daemon_running(char* cmd, char* pidfile)
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-sh.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-sh.patch
new file mode 100644
index 000000000000..a1f45939f2a1
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-sh.patch
@@ -0,0 +1,226 @@
+diff -ur sbin/rc-daemon.sh @GENTOO_PORTAGE_EPREFIX@/lib/rcscripts/sh/rc-daemon.sh
+--- baselayout-1.12.5/sbin/rc-daemon.sh 2006-09-14 14:11:34 +0400
++++ baselayout-1.12.5/sbin/rc-daemon.sh 2007-10-18 01:20:10 +0400
+@@ -226,7 +229,7 @@
+ # We don't do anyting fancy - just pass the given options
+ # to start-stop-daemon and return the value
+ rc_start_daemon() {
+- eval /sbin/start-stop-daemon "${args}"
++ eval @GENTOO_PORTAGE_EPREFIX@/sbin/start-stop-daemon "${args}"
+ local retval="$?"
+
+ [[ ${retval} != "0" ]] && return "${retval}"
+@@ -365,7 +368,7 @@
+
+ # We pass --oknodo and --test directly to start-stop-daemon and return
+ if ${nothing}; then
+- eval /sbin/start-stop-daemon "${args}"
++ eval @GENTOO_PORTAGE_EPREFIX@/sbin/start-stop-daemon "${args}"
+ return "$?"
+ fi
+
+diff -ur sbin/rc-services.sh @GENTOO_PORTAGE_EPREFIX@/lib/rcscripts/sh/rc-services.sh
+--- baselayout-1.12.5/sbin/rc-services.sh 2006-09-14 14:11:34 +0400
++++ baselayout-1.12.5/sbin/rc-services.sh 2007-10-18 01:25:55 +0400
+@@ -8,9 +8,9 @@
+
+ if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then
+ # Only try and update if we are root
+- if [[ ${EUID} == "0" ]] && ! /sbin/depscan.sh ; then
++ if [[ ${EUID} == "0" ]] && ! @GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh ; then
+ echo
+- eerror "Error running '/sbin/depscan.sh'!"
++ eerror "Error running '@GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh'!"
+ eerror "Please correct any problems above."
+ exit 1
+ fi
+@@ -19,7 +19,7 @@
+ if [[ ${RC_GOT_DEPTREE_INFO} != "yes" ]] ; then
+ echo
+ eerror "Dependency info is missing! Please run"
+- eerror " # /sbin/depscan.sh"
++ eerror " # @GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh"
+ eerror "to fix this."
+ exit 1
+ fi
+@@ -134,7 +134,7 @@
+ if ! get_dep_info "${myservice}" >/dev/null ; then
+ eerror "Could not get dependency info for ${myservice}!" > /dev/stderr
+ eerror "Please run:" > /dev/stderr
+- eerror " # /sbin/depscan.sh" > /dev/stderr
++ eerror " # @GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh" > /dev/stderr
+ eerror "to try and fix this." > /dev/stderr
+ return 1
+ fi
+@@ -212,11 +212,11 @@
+
+ [[ -z $1 || -z $2 ]] && return 1
+
+- [[ $2 != "${BOOTLEVEL}" && -e /etc/runlevels/"${BOOTLEVEL}"/.fake ]] && \
+- fake_services="$( < /etc/runlevels/"${BOOTLEVEL}"/.fake )"
++ [[ $2 != "${BOOTLEVEL}" && -e @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"${BOOTLEVEL}"/.fake ]] && \
++ fake_services="$( < @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"${BOOTLEVEL}"/.fake )"
+
+- [[ -e /etc/runlevels/"$2"/.fake ]] && \
+- fake_services="${fake_services} $( < /etc/runlevels/"$2"/.fake )"
++ [[ -e @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"$2"/.fake ]] && \
++ fake_services="${fake_services} $( < @GENTOO_PORTAGE_EPREFIX@/etc/runlevels/"$2"/.fake )"
+
+ for x in ${fake_services} ; do
+ [[ $1 == "${x##*/}" ]] && return 0
+@@ -232,7 +232,7 @@
+ in_runlevel() {
+ [[ -z $1 || -z $2 ]] && return 1
+
+- [[ -L "/etc/runlevels/$2/$1" ]] && return 0
++ [[ -L "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/$2/$1" ]] && return 0
+
+ return 1
+ }
+@@ -385,7 +385,7 @@
+ local service="$1"
+ [[ -z ${service} ]] && return 1
+
+- if [[ ! -e "/etc/init.d/${service}" ]] ; then
++ if [[ ! -e "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" ]] ; then
+ mark_service_stopped "${service}"
+ return 1
+ fi
+@@ -408,8 +408,8 @@
+ # if we can not start the services in parallel
+ # then just start it and return the exit status
+ (
+- profiling name "/etc/init.d/${service} start"
+- "/etc/init.d/${service}" start
++ profiling name "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service} start"
++ "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" start
+ )
+
+ service_started "${service}" || service_inactive "${service}" \
+@@ -423,8 +423,8 @@
+ else
+ # if parallel startup is allowed, start it in background
+ (
+- profiling name "/etc/init.d/${service} start"
+- "/etc/init.d/${service}" start
++ profiling name "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service} start"
++ "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" start
+
+ service_started "${service}" || service_inactive "${service}" \
+ || service_scheduled "${service}"
+@@ -445,7 +445,7 @@
+ local service="$1"
+ [[ -z ${service} ]] && return 1
+
+- if [[ ! -e "/etc/init.d/${service}" ]] ; then
++ if [[ ! -e "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" ]] ; then
+ mark_service_stopped "${service}"
+ return 0
+ fi
+@@ -470,7 +470,7 @@
+ ${STOP_CRITICAL} == "yes" ]] ; then
+ # if we can not start the services in parallel
+ # then just start it and return the exit status
+- ( "/etc/init.d/${service}" stop )
++ ( "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" stop )
+ service_stopped "${service}"
+ retval=$?
+ end_service "${service}" "${retval}"
+@@ -479,7 +479,7 @@
+ else
+ # if parallel startup is allowed, start it in background
+ (
+- ( "/etc/init.d/${service}" stop )
++ ( "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" stop )
+ service_stopped "${service}"
+ retval=$?
+ end_service "${service}" "${retval}"
+@@ -496,7 +496,7 @@
+ mark_service_coldplugged() {
+ [[ -z $1 ]] && return 1
+
+- ln -snf "/etc/init.d/$1" "${svcdir}/coldplugged/$1"
++ ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/coldplugged/$1"
+ return 0
+ }
+
+@@ -507,7 +507,7 @@
+ mark_service_starting() {
+ [[ -z $1 ]] && return 1
+
+- ln -sn "/etc/init.d/$1" "${svcdir}/starting/$1" 2>/dev/null || return 1
++ ln -sn "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/starting/$1" 2>/dev/null || return 1
+
+ [[ -f "${svcdir}/started/$1" ]] && rm -f "${svcdir}/started/$1"
+ [[ -f "${svcdir}/inactive/$1" ]] \
+@@ -522,7 +522,7 @@
+ mark_service_started() {
+ [[ -z $1 ]] && return 1
+
+- ln -snf "/etc/init.d/$1" "${svcdir}/started/$1"
++ ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/started/$1"
+
+ rm -f "${svcdir}/starting/$1" "${svcdir}/inactive/$1" \
+ "${svcdir}/wasinactive/$1" "${svcdir}/stopping/$1" \
+@@ -538,7 +538,7 @@
+ mark_service_inactive() {
+ [[ -z $1 ]] && return 1
+
+- ln -snf "/etc/init.d/$1" "${svcdir}/inactive/$1"
++ ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/inactive/$1"
+
+ rm -f "${svcdir}/started/$1" "${svcdir}/wasinactive/$1" \
+ "${svcdir}/starting/$1" "${svcdir}/stopping/$1"
+@@ -553,7 +553,7 @@
+ mark_service_stopping() {
+ [[ -z $1 ]] && return 1
+
+- ln -sn "/etc/init.d/$1" "${svcdir}/stopping/$1" 2>/dev/null || return 1
++ ln -sn "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/stopping/$1" 2>/dev/null || return 1
+
+ rm -f "${svcdir}/started/$1"
+ [[ -f "${svcdir}/inactive/$1" ]] \
+@@ -690,7 +691,7 @@
+ mark_service_failed() {
+ [[ -z $1 || ! -d "${svcdir}/failed" ]] && return 1
+
+- ln -snf "/etc/init.d/$1" "${svcdir}/failed/$1"
++ ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/$1" "${svcdir}/failed/$1"
+ }
+
+ # bool service_failed(service)
+@@ -744,8 +745,8 @@
+ return $?
+ ;;
+ yes)
+- for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \
+- $(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") ; do
++ for x in $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/net.*") \
++ $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${SOFTLEVEL}/net.*") ; do
+ local y="${x##*/}"
+ [[ ${y} == "$1" ]] && return 1
+ service_started "${y}" || return 1
+@@ -785,8 +786,8 @@
+ [[ -f "${svcdir}/softlevel" ]] && mylevel=$( < "${svcdir}/softlevel" )
+
+ for x in $( i$1 "$2" ) ; do
+- [[ -e "/etc/runlevels/${BOOTLEVEL}/${x}" || \
+- -e "/etc/runlevels/${mylevel}/${x}" || \
++ [[ -e "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/${x}" || \
++ -e "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${mylevel}/${x}" || \
+ ${x} == "net" ]] \
+ && valid="${valid} ${x}"
+ done
+@@ -836,9 +837,9 @@
+ net_services="${net_services} ${x##*/}"
+ done
+ else
+- for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \
+- $(dolisting "/etc/runlevels/${SOFTLEVEL}/net.*") \
+- $(dolisting "/etc/runlevels/coldplugged/net.*") ; do
++ for x in $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/net.*") \
++ $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${SOFTLEVEL}/net.*") \
++ $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/coldplugged/net.*") ; do
+ net_services="${net_services} ${x##*/}"
+ done
+ fi
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-src.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-src.patch
new file mode 100644
index 000000000000..a6ee5dbf3032
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix-src.patch
@@ -0,0 +1,102 @@
+--- baselayout-1.12.5/src/runscript.c 2007-10-17 21:11:10 +0400
++++ baselayout-1.12.5/src/runscript.c 2007-10-17 21:13:56 +0400
+@@ -22,16 +22,16 @@
+ # define LIBDIR "lib"
+ #endif
+
+-#define SBIN_RC "/sbin/rc"
+-#define PROFILE_ENV "/etc/profile.env"
+-#define RCSCRIPTS_LIB "/" LIBDIR "/rcscripts"
++#define SBIN_RC "@GENTOO_PORTAGE_EPREFIX@/sbin/rc"
++#define PROFILE_ENV "@GENTOO_PORTAGE_EPREFIX@/etc/profile.env"
++#define RCSCRIPTS_LIB "@GENTOO_PORTAGE_EPREFIX@/" LIBDIR "/rcscripts"
+ #define SYS_WHITELIST RCSCRIPTS_LIB "/conf.d/env_whitelist"
+-#define USR_WHITELIST "/etc/conf.d/env_whitelist"
++#define USR_WHITELIST "@GENTOO_PORTAGE_EPREFIX@/etc/conf.d/env_whitelist"
+ #define RCSCRIPT_HELP RCSCRIPTS_LIB "/sh/rc-help.sh"
+ #define SELINUX_LIB RCSCRIPTS_LIB "/runscript_selinux.so"
+ #define SOFTLEVEL "SOFTLEVEL"
+
+-#define DEFAULT_PATH "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin"
++#define DEFAULT_PATH "PATH=@GENTOO_PORTAGE_EPREFIX@/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/local/sbin"
+
+ #define IS_SBIN_RC() (0 == strcmp(caller, SBIN_RC))
+
+@@ -217,7 +217,7 @@
+ int new = 1;
+
+ /* Need to be /bin/bash, else BASH is invalid */
+- myargs[0] = "/bin/bash";
++ myargs[0] = "@GENTOO_PORTAGE_EPREFIX@/bin/bash";
+ while (argv[new] != 0) {
+ myargs[new] = argv[new];
+ new++;
+@@ -243,10 +243,10 @@
+ setup_selinux(argc, argv);
+
+ if (!IS_SBIN_RC()) {
+- if (execve("/sbin/runscript.sh", myargs, myenv) < 0)
++ if (execve("@GENTOO_PORTAGE_EPREFIX@/sbin/runscript.sh", myargs, myenv) < 0)
+ exit(1);
+ } else {
+- if (execve("/bin/bash", myargs, myenv) < 0)
++ if (execve("@GENTOO_PORTAGE_EPREFIX@/bin/bash", myargs, myenv) < 0)
+ exit(1);
+ }
+
+diff -ur ./sbin/depscan.sh /Users/dirk/src@GENTOO_PORTAGE_EPREFIX@/sbin/depscan.sh
+--- baselayout-1.12.5/sbin/depscan.sh 2007-10-17 21:26:21 +0400
++++ baselayout-1.12.5/sbin/depscan.sh 2007-10-17 18:58:23 +0400
+@@ -7,7 +7,7 @@
+ fi
+
+ argv0=${0##*/}
+-source /etc/init.d/functions.sh || {
++source @GENTOO_PORTAGE_EPREFIX@/etc/init.d/functions.sh || {
+ echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2
+ exit 1
+ }
+@@ -89,7 +91,7 @@
+ fi
+
+ touch "${mtime_test}"
+- for config in /etc/conf.d/* /etc/init.d/* /etc/rc.conf
++ for config in @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/* @GENTOO_PORTAGE_EPREFIX@/etc/init.d/* @GENTOO_PORTAGE_EPREFIX@/etc/rc.conf
+ do
+ ! ${update} \
+ && is_older_than "${mysvcdir}/depcache" "${config}" \
+@@ -104,7 +106,7 @@
+ rm -f "${mtime_test}"
+
+ if [[ ${clock_screw} == 1 ]] ; then
+- ewarn "One of the files in /etc/{conf.d,init.d} or /etc/rc.conf"
++ ewarn "One of the files in @GENTOO_PORTAGE_EPREFIX@/etc/{conf.d,init.d} or @GENTOO_PORTAGE_EPREFIX@/etc/rc.conf"
+ ewarn "has a modification time in the future!"
+ fi
+
+@@ -125,17 +127,17 @@
+
+ export SVCDIR DEPTYPES ORDTYPES
+
+-cd /etc/init.d
++cd @GENTOO_PORTAGE_EPREFIX@/etc/init.d
+
+-/bin/gawk \
+- -f /lib/rcscripts/awk/functions.awk \
+- -f /lib/rcscripts/awk/cachedepends.awk || \
++@GENTOO_PORTAGE_EPREFIX@/bin/gawk \
++ -f @GENTOO_PORTAGE_EPREFIX@/lib/rcscripts/awk/functions.awk \
++ -f @GENTOO_PORTAGE_EPREFIX@/lib/rcscripts/awk/cachedepends.awk || \
+ retval=1
+
+-bash "${mysvcdir}/depcache" | \
+-/bin/gawk \
+- -f /lib/rcscripts/awk/functions.awk \
+- -f /lib/rcscripts/awk/gendepends.awk || \
++@GENTOO_PORTAGE_EPREFIX@/bin/bash "${mysvcdir}/depcache" | \
++@GENTOO_PORTAGE_EPREFIX@/bin/gawk \
++ -f @GENTOO_PORTAGE_EPREFIX@/lib/rcscripts/awk/functions.awk \
++ -f @GENTOO_PORTAGE_EPREFIX@/lib/rcscripts/awk/gendepends.awk || \
+ retval=1
+
+ touch "${mysvcdir}"/dep{cache,tree}
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix.patch
new file mode 100644
index 000000000000..3394a323a07a
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-prefix.patch
@@ -0,0 +1,409 @@
+--- baselayout-1.12.5/etc/env.d/00basic
++++ baselayout-1.12.5/etc/env.d/00basic
+@@ -1,10 +1,11 @@
+-# /etc/env.d/00basic
++# @GENTOO_PORTAGE_EPREFIX@/etc/env.d/00basic
+
+-PATH="/opt/bin"
+-ROOTPATH="/opt/bin"
+-LDPATH="/usr/local/lib"
+-MANPATH="/usr/local/share/man:/usr/share/man"
+-INFOPATH="/usr/share/info"
++# in prefix we have sbin variants in user path!
++PATH="@GENTOO_PORTAGE_EPREFIX@/opt/bin:@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/sbin"
++ROOTPATH="@GENTOO_PORTAGE_EPREFIX@/opt/bin"
++LDPATH="@GENTOO_PORTAGE_EPREFIX@/usr/local/lib"
++MANPATH="@GENTOO_PORTAGE_EPREFIX@/usr/share/man"
++INFOPATH="@GENTOO_PORTAGE_EPREFIX@/usr/share/info"
+ CVS_RSH="ssh"
+-PAGER="/usr/bin/less"
++PAGER="@GENTOO_PORTAGE_EPREFIX@/usr/bin/less"
+ LESSOPEN="|lesspipe.sh %s"
+--- baselayout-1.12.5/sbin/env-update.sh
++++ baselayout-1.12.5/sbin/env-update.sh
+@@ -1,10 +1,10 @@
+-#!/bin/bash
++#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+ # Copyright 1999-2004 Gentoo Foundation
+ # Distributed under the terms of the GNU General Public License v2
+
+-source /sbin/functions.sh || exit 1
++source "@GENTOO_PORTAGE_EPREFIX@"/sbin/functions.sh || exit 1
+
+-if [[ ${EUID} != "0" ]] ; then
++if [[ ${EPREFIX/\//} == "" ]] && [[ ${EUID} != "0" ]] ; then
+ eerror "$0: must be root."
+ exit 1
+ fi
+@@ -13,8 +13,8 @@
+ echo "usage: env-update.sh
+
+ note:
+- This utility generates /etc/profile.env and /etc/csh.env
+- from the contents of /etc/env.d/
++ This utility generates @GENTOO_PORTAGE_EPREFIX@/etc/profile.env and @GENTOO_PORTAGE_EPREFIX@/etc/csh.env
++ from the contents of @GENTOO_PORTAGE_EPREFIX@/etc/env.d/
+ "
+ exit 1
+ }
+@@ -30,9 +30,9 @@
+ if [[ $# != "0" ]] ; then
+ usage
+ else
+- /bin/gawk \
+- -f /lib/rcscripts/awk/functions.awk \
+- -f /lib/rcscripts/awk/genenviron.awk
++ "@GENTOO_PORTAGE_EPREFIX@"/bin/gawk \
++ -f "@GENTOO_PORTAGE_EPREFIX@"/lib/rcscripts/awk/functions.awk \
++ -f "@GENTOO_PORTAGE_EPREFIX@"/lib/rcscripts/awk/genenviron.awk
+ fi
+
+ # vim:ts=4
+--- baselayout-1.12.5/sbin/functions.sh
++++ baselayout-1.12.5/sbin/functions.sh
+@@ -4,11 +4,11 @@
+ RC_GOT_FUNCTIONS="yes"
+
+ # Override defaults with user settings ...
+-[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
++[[ -f @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/rc ]] && source "@GENTOO_PORTAGE_EPREFIX@"/etc/conf.d/rc
+
+ # Check /etc/conf.d/rc for a description of these ...
+-declare -r svclib="/lib/rcscripts"
+-declare -r svcdir="${svcdir:-/var/lib/init.d}"
++declare -r svclib="@GENTOO_PORTAGE_EPREFIX@/lib/rcscripts"
++declare -r svcdir="${svcdir:-@GENTOO_PORTAGE_EPREFIX@/var/lib/init.d}"
+ svcmount="${svcmount:-no}"
+ svcfstype="${svcfstype:-tmpfs}"
+ svcsize="${svcsize:-1024}"
+@@ -83,7 +84,7 @@
+ }
+ # This will override the splash() function...
+ if ! import_addon splash-functions.sh ; then
+- [[ -f /sbin/splash-functions.sh ]] && source /sbin/splash-functions.sh
++ [[ -f @GENTOO_PORTAGE_EPREFIX@/sbin/splash-functions.sh ]] && source "@GENTOO_PORTAGE_EPREFIX@"/sbin/splash-functions.sh
+ fi
+
+ # void profiling(...)
+@@ -114,8 +115,8 @@
+ local newbootlevel=
+ local newsoftlevel=
+
+- if [[ -r /proc/cmdline ]] ; then
+- for copt in $(</proc/cmdline) ; do
++ if [[ -r @GENTOO_PORTAGE_EPREFIX@/proc/cmdline ]] ; then
++ for copt in $(<"@GENTOO_PORTAGE_EPREFIX@"/proc/cmdline) ; do
+ case "${copt%=*}" in
+ bootlevel)
+ newbootlevel="${copt##*=}"
+@@ -153,8 +154,8 @@
+ fi
+
+ if [[ ${RC_USE_CONFIG_PROFILE} == "yes" && -n ${DEFAULTLEVEL} ]] && \
+- [[ -d "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" || \
+- -L "/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" ]] ; then
++ [[ -d "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" || \
++ -L "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}.${DEFAULTLEVEL}" ]] ; then
+ export BOOTLEVEL="${BOOTLEVEL}.${DEFAULTLEVEL}"
+ fi
+
+@@ -176,8 +177,8 @@
+ get_libdir() {
+ if [[ -n ${CONF_LIBDIR_OVERRIDE} ]] ; then
+ CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}"
+- elif [[ -x /usr/bin/portageq ]] ; then
+- CONF_LIBDIR="$(/usr/bin/portageq envvar CONF_LIBDIR)"
++ elif [[ -x @GENTOO_PORTAGE_EPREFIX@/usr/bin/portageq ]] ; then
++ CONF_LIBDIR="$("@GENTOO_PORTAGE_EPREFIX@"/usr/bin/portageq envvar CONF_LIBDIR)"
+ fi
+ echo "${CONF_LIBDIR:=lib}"
+ }
+@@ -190,14 +191,14 @@
+ local pri=
+ local tag=
+
+- if [[ -x /usr/bin/logger ]] ; then
++ if [[ -x @GENTOO_PORTAGE_EPREFIX@/usr/bin/logger ]] ; then
+ pri="$1"
+ tag="$2"
+
+ shift 2
+ [[ -z "$*" ]] && return 0
+
+- /usr/bin/logger -p "${pri}" -t "${tag}" -- "$*"
++ "@GENTOO_PORTAGE_EPREFIX@"/usr/bin/logger -p "${pri}" -t "${tag}" -- "$*"
+ fi
+
+ return 0
+@@ -269,7 +270,7 @@
+ fi
+
+ local name="rc-scripts"
+- [[ $0 != "/sbin/runscript.sh" ]] && name="${0##*/}"
++ [[ $0 != "@GENTOO_PORTAGE_EPREFIX@/sbin/runscript.sh" ]] && name="${0##*/}"
+ # Log warnings to system log
+ esyslog "daemon.warning" "${name}" "$*"
+
+@@ -290,7 +291,7 @@
+ fi
+
+ local name="rc-scripts"
+- [[ $0 != "/sbin/runscript.sh" ]] && name="${0##*/}"
++ [[ $0 != "@GENTOO_PORTAGE_EPREFIX@/sbin/runscript.sh" ]] && name="${0##*/}"
+ # Log errors to system log
+ esyslog "daemon.err" "rc-scripts" "$*"
+
+@@ -488,9 +489,9 @@
+ get_bootparam() {
+ local x copt params retval=1
+
+- [[ ! -r /proc/cmdline ]] && return 1
++ [[ ! -r @GENTOO_PORTAGE_EPREFIX@/proc/cmdline ]] && return 1
+
+- for copt in $(< /proc/cmdline) ; do
++ for copt in $(< "@GENTOO_PORTAGE_EPREFIX@"/proc/cmdline) ; do
+ if [[ ${copt%=*} == "gentoo" ]] ; then
+ params=$(gawk -v PARAMS="${copt##*=}" '
+ BEGIN {
+@@ -583,8 +584,8 @@
+ # get the version of baselayout that this system is running
+ #
+ get_base_ver() {
+- [[ ! -r /etc/gentoo-release ]] && return 0
+- local ver="$(</etc/gentoo-release)"
++ [[ ! -r @GENTOO_PORTAGE_EPREFIX@/etc/gentoo-release ]] && return 0
++ local ver="$(<"@GENTOO_PORTAGE_EPREFIX@"/etc/gentoo-release)"
+ echo "${ver##* }"
+ }
+
+@@ -602,8 +603,8 @@
+ is_net_fs() {
+ local fstype
+ # /proc/mounts is always accurate but may not always be available
+- if [[ -e /proc/mounts ]] ; then
+- fstype="$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' /proc/mounts )"
++ if [[ -e @GENTOO_PORTAGE_EPREFIX@/proc/mounts ]] ; then
++ fstype="$( sed -n -e '/^rootfs/!s:.* '"$1"' \([^ ]*\).*:\1:p' "@GENTOO_PORTAGE_EPREFIX@"/proc/mounts )"
+ else
+ fstype="$( mount | sed -n -e 's:.* on '"$1"' type \([^ ]*\).*:\1:p' )"
+ fi
+@@ -618,7 +619,7 @@
+ # EXAMPLE: if is_union_fs / ; then ...
+ #
+ is_union_fs() {
+- [[ ! -x /sbin/unionctl ]] && return 1
++ [[ ! -x @GENTOO_PORTAGE_EPREFIX@/sbin/unionctl ]] && return 1
+ unionctl "$1" --list &>/dev/null
+ }
+
+@@ -629,7 +630,7 @@
+ # EXAMPLE: if is_uml_sys ; then ...
+ #
+ is_uml_sys() {
+- grep -qs 'UML' /proc/cpuinfo
++ grep -qs 'UML' "@GENTOO_PORTAGE_EPREFIX@"/proc/cpuinfo
+ }
+
+ # bool is_vserver_sys()
+@@ -639,7 +640,7 @@
+ # EXAMPLE: if is_vserver_sys ; then ...
+ #
+ is_vserver_sys() {
+- grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status
++ grep -qs '^s_context:[[:space:]]*[1-9]' "@GENTOO_PORTAGE_EPREFIX@"/proc/self/status
+ }
+
+ # bool is_xenU_sys()
+@@ -649,9 +650,9 @@
+ # EXAMPLE: if is_xenU_sys ; then ...
+ #
+ is_xenU_sys() {
+- [[ ! -d /proc/xen ]] && return 1
+- [[ ! -r /proc/xen/capabilities ]] && return 1
+- grep -q "control_d" /proc/xen/capabilities && return 1
++ [[ ! -d "@GENTOO_PORTAGE_EPREFIX@"/proc/xen ]] && return 1
++ [[ ! -r "@GENTOO_PORTAGE_EPREFIX@"/proc/xen/capabilities ]] && return 1
++ grep -q "control_d" "@GENTOO_PORTAGE_EPREFIX@"/proc/xen/capabilities && return 1
+ return 0
+ }
+
+@@ -667,7 +668,7 @@
+ gawk '$1 ~ "^#" { next }
+ $2 == "'$*'" { stab="-t "$3" -o "$4" "$1" "$2; }
+ END { print stab; }
+- ' /etc/fstab
++ ' "@GENTOO_PORTAGE_EPREFIX@"/etc/fstab
+ }
+
+ # char *reverse_list(list)
+@@ -771,13 +772,13 @@
+ # Setup a basic $PATH. Just add system default to existing.
+ # This should solve both /sbin and /usr/sbin not present when
+ # doing 'su -c foo', or for something like: PATH= rcscript start
+- PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:${PATH}"
++ PATH="@GENTOO_PORTAGE_EPREFIX@/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/local/sbin:${PATH}"
+
+ # Cache the CONSOLETYPE - this is important as backgrounded shells don't
+ # have a TTY. rc unsets it at the end of running so it shouldn't hang
+ # around
+ if [[ -z ${CONSOLETYPE} ]] ; then
+- export CONSOLETYPE="$( /sbin/consoletype 2>/dev/null )"
++ export CONSOLETYPE="$( "@GENTOO_PORTAGE_EPREFIX@"/sbin/consoletype 2>/dev/null )"
+ fi
+ if [[ ${CONSOLETYPE} == "serial" ]] ; then
+ RC_NOCOLOR="yes"
+@@ -797,7 +798,7 @@
+
+ # If we are not /sbin/rc then ensure that we cannot change level variables
+ if [[ -n ${BASH_SOURCE} \
+- && ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} != "/sbin/rc" ]] ; then
++ && ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} != "@GENTOO_PORTAGE_EPREFIX@/sbin/rc" ]] ; then
+ declare -r BOOTLEVEL DEFAULTLEVEL SOFTLEVEL
+ fi
+ else
+--- baselayout-1.12.5/etc/profile
++++ baselayout-1.12.5/etc/profile
+@@ -1,4 +1,4 @@
+-# /etc/profile: login shell setup
++# @GENTOO_PORTAGE_EPREFIX@/etc/profile: login shell setup
+ #
+ # That this file is used by any Bourne-shell derivative to setup the
+ # environment for login shells.
+@@ -6,8 +6,8 @@
+
+ # Load environment settings from profile.env, which is created by
+ # env-update from the files in /etc/env.d
+-if [ -e /etc/profile.env ] ; then
+- . /etc/profile.env
++if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then
++ . "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env
+ fi
+
+ # 077 would be more secure, but 022 is generally quite realistic
+@@ -22,23 +22,23 @@
+ # This way the evaluation can be short-circuited and calling whoami is
+ # avoided.
+ if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
+- PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin"
+ else
+- PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
++ PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin"
+ fi
+ export PATH
+ unset ROOTPATH
+
+ # Extract the value of EDITOR
+-[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`"
+-[ -z "$EDITOR" ] && EDITOR="/bin/nano"
++[ -z "$EDITOR" ] && EDITOR="`. @GENTOO_PORTAGE_EPREFIX@/etc/rc.conf 2>/dev/null; echo $EDITOR`"
++[ -z "$EDITOR" ] && EDITOR="@GENTOO_PORTAGE_EPREFIX@/bin/nano"
+ export EDITOR
+
+ if [ -n "${BASH_VERSION}" ] ; then
+ # Newer bash ebuilds include /etc/bash/bashrc which will setup PS1
+ # including color. We leave out color here because not all
+ # terminals support it.
+- if [ -f /etc/bash/bashrc ] ; then
++ if [ -f "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc ] ; then
+ # Bash login shells run only /etc/profile
+ # Bash non-login shells run only /etc/bash/bashrc
+ # Since we want to run /etc/bash/bashrc regardless, we source it
+@@ -46,7 +46,7 @@
+ # this *after* the user's .bash_profile runs (without putting
+ # it in the user's dot-files), but it shouldn't make any
+ # difference.
+- . /etc/bash/bashrc
++ . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc
+ else
+ PS1='\u@\h \w \$ '
+ fi
+@@ -57,7 +57,7 @@
+ PS1="`whoami`@`uname -n | cut -f1 -d.` \$ "
+ fi
+
+-for sh in /etc/profile.d/*.sh ; do
++for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do
+ if [ -r "$sh" ] ; then
+ . "$sh"
+ fi
+--- baselayout-1.12.5/sbin/runscript.sh~ 2006-09-14 12:11:34 +0200
++++ baselayout-1.12.5/sbin/runscript.sh 2007-10-06 13:28:40 +0200
+@@ -1,18 +1,18 @@
+-#!/bin/bash
++#!@GENTOO_PORTAGE_EPREFIX@/bin/bash
+ # Copyright 1999-2006 Gentoo Foundation
+ # Distributed under the terms of the GNU General Public License v2
+
+ # Common functions
+-[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh
++[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source @GENTOO_PORTAGE_EPREFIX@/sbin/functions.sh
+
+-# User must be root to run most script stuff (except status)
+-if [[ ${EUID} != "0" ]] && ! [[ $2 == "status" && $# -eq 2 ]] ; then
+- eerror "$0: must be root to run init scripts"
+- exit 1
+-fi
++## User must be root to run most script stuff (except status)
++#if [[ ${EUID} != "0" ]] && ! [[ $2 == "status" && $# -eq 2 ]] ; then
++# eerror "$0: must be root to run init scripts"
++# exit 1
++#fi
+
+ myscript="$1"
+-if [[ -L $1 && ! -L "/etc/init.d/${1##*/}" ]] ; then
++if [[ -L $1 && ! -L "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${1##*/}" ]] ; then
+ SVCNAME="$(readlink "$1")"
+ else
+ SVCNAME="$1"
+@@ -84,12 +84,12 @@
+ # configuration, if the system administrator chose to put it
+ # there (if it exists).
+ if net_service "${SVCNAME}" ; then
+- conf="$(add_suffix /etc/conf.d/net)"
++ conf="$(add_suffix @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/net)"
+ [[ -e ${conf} ]] && source "${conf}"
+ fi
+-conf="$(add_suffix "/etc/conf.d/${SVCNAME}")"
++conf="$(add_suffix "@GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${SVCNAME}")"
+ [[ -e ${conf} ]] && source "${conf}"
+-conf="$(add_suffix /etc/rc.conf)"
++conf="$(add_suffix @GENTOO_PORTAGE_EPREFIX@/etc/rc.conf)"
+ [[ -e ${conf} ]] && source "${conf}"
+
+ mylevel="${SOFTLEVEL}"
+@@ -146,7 +146,7 @@
+ local service="$1" start="$2"
+ [[ ! -d "${svcdir}/scheduled/${service}" ]] \
+ && mkdir -p "${svcdir}/scheduled/${service}"
+- ln -snf "/etc/init.d/${service}" \
++ ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" \
+ "${svcdir}/scheduled/${service}/${start}"
+ }
+
+@@ -334,9 +334,9 @@
+ if [[ ${retval} == "0" && ${RC_NO_DEPS} != "yes" ]] ; then
+ local startupservices="$(ineed "${SVCNAME}") $(valid_iuse "${SVCNAME}")"
+ local netservices=
+- for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \
+- $(dolisting "/etc/runlevels/${mylevel}/net.*") \
+- $(dolisting "/var/lib/init.d/coldplugged/net.*") ; do
++ for x in $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/net.*") \
++ $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${mylevel}/net.*") \
++ $(dolisting "@GENTOO_PORTAGE_EPREFIX@/var/lib/init.d/coldplugged/net.*") ; do
+ netservices="${netservices} ${x##*/}"
+ done
+
+@@ -631,9 +631,9 @@
+
+ # Simple way to try and detect if the service use svc_{start,stop}
+ # to restart if it have a custom restart() funtion.
+- if [[ -n $(egrep '^[[:space:]]*restart[[:space:]]*()' "/etc/init.d/${SVCNAME}") ]] ; then
+- if [[ -z $(egrep 'svc_stop' "/etc/init.d/${SVCNAME}") || \
+- -z $(egrep 'svc_start' "/etc/init.d/${SVCNAME}") ]] ; then
++ if [[ -n $(egrep '^[[:space:]]*restart[[:space:]]*()' "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${SVCNAME}") ]] ; then
++ if [[ -z $(egrep 'svc_stop' "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${SVCNAME}") || \
++ -z $(egrep 'svc_start' "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${SVCNAME}") ]] ; then
+ echo
+ ewarn "Please use 'svc_stop; svc_start' and not 'stop; start' to"
+ ewarn "restart the service in its custom 'restart()' function."
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-solaris.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-solaris.patch
new file mode 100644
index 000000000000..20e45827acdd
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-solaris.patch
@@ -0,0 +1,66 @@
+--- src/start-stop-daemon.c
++++ src/start-stop-daemon.c
+@@ -44,7 +44,7 @@
+ # define OSLinux
+ #elif defined(__GNU__)
+ # define OSHURD
+-#elif defined(__sparc__)
++#elif defined (__SVR4) && defined (__sun)
+ # define OSsunos
+ #elif defined(OPENBSD) || defined(__OpenBSD__)
+ # define OSOpenBSD
+@@ -94,6 +94,9 @@
+ #if defined(OSaix)
+ #include <sys/procfs.h>
+ #endif
++#if defined(OSsunos)
++#include <procfs.h>
++#endif
+
+ #include <errno.h>
+ #include <stdio.h>
+@@ -188,7 +191,7 @@
+ static void do_pidfile(const char *name);
+ static void do_stop(int signal_nr, int quietmode,
+ int *n_killed, int *n_notkilled, int retry_nr);
+-#if defined(OSLinux) || defined(OShpux) || defined(OSaix)
++#if defined(OSLinux) || defined(OShpux) || defined(OSaix) || defined(OSsunos)
+ static int pid_is_exec(pid_t pid, const struct stat *esb);
+ #endif
+
+@@ -765,7 +768,7 @@
+ static void
+ check(pid_t pid)
+ {
+-#if defined(OSLinux) || defined(OShpux) || defined(OSaix)
++#if defined(OSLinux) || defined(OShpux) || defined(OSaix) || defined(OSsunos)
+ if (execname && !pid_is_exec(pid, &exec_stat))
+ return;
+ #elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD) || defined(OSDarwin)
+@@ -801,7 +804,7 @@
+ /* WTA: this needs to be an autoconf check for /proc/pid existance.
+ */
+
+-#if defined(OSLinux) || defined (OSsunos) || defined(OSfreebsd) || defined(OSaix)
++#if defined(OSLinux) || defined (OSsunos) || defined(OSfreebsd) || defined(OSaix) || defined(OSsunos)
+ static void
+ do_procinit(void)
+ {
+@@ -1069,7 +1072,7 @@
+ }
+ #endif /* OShpux */
+
+-#if defined(OSaix)
++#if defined(OSaix) || defined(OSsunos)
+ /* max possible pid (signed long) in theory:
+ * 32bit: 2147483647 (10 digits)
+ * 64bit: 9223372036854775807 (19 digits)
+@@ -1119,7 +1122,7 @@
+ }
+ return strcmp(name, psi.pr_fname) == 0;
+ }
+-#endif /* OSaix */
++#endif /* OSaix || OSsunos */
+
+
+ static void
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-strsep.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-strsep.patch
new file mode 100644
index 000000000000..3e67a226c77c
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-strsep.patch
@@ -0,0 +1,42 @@
+--- src/core/misc.h
++++ src/core/misc.h
+@@ -284,5 +284,9 @@
+ void file_unmap(char *buf, size_t bufsize);
+ size_t buf_get_line(char *buf, size_t buflen, size_t cur);
+
++#if defined (__SVR4) && defined (__sun)
++char* strsep(char** str, const char* delims);
++#endif
++
+ #endif /* _MISC_H */
+
+--- src/core/misc.c
++++ src/core/misc.c
+@@ -647,3 +647,27 @@
+ return count - cur;
+ }
+
++#if defined (__SVR4) && defined (__sun)
++char* strsep(char** str, const char* delims)
++{
++ char* token;
++
++ if (*str == NULL) {
++ /* No more tokens */
++ return NULL;
++ }
++
++ token=*str;
++ while (**str != '\0') {
++ if (strchr(delims, **str) != NULL) {
++ **str = '\0';
++ (*str)++;
++ return token;
++ }
++ (*str)++;
++ }
++ /* There is no other token */
++ *str = NULL;
++ return token;
++}
++#endif
diff --git a/sys-apps/baselayout-prefix/files/baselayout-1.12.5-termios_h.patch b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-termios_h.patch
new file mode 100644
index 000000000000..8c84bf6ce33a
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/baselayout-1.12.5-termios_h.patch
@@ -0,0 +1,30 @@
+<termios.h> is standard as per SUSv2 already:
+http://pubs.opengroup.org/onlinepubs/007908799/xsh/termios.h.html
+AIX does not provide <sys/termios.h> at all, Linux, Solaris, HP-UX,
+Darwin and Interix have both, redirecting one to the other.
+
+--- src/start-stop-daemon.c.orig 2011-03-28 13:55:36 +0200
++++ src/start-stop-daemon.c 2011-03-28 14:50:47 +0200
+@@ -37,6 +37,9 @@
+ #define NONRETURNING \
+ __attribute__((noreturn))
+
++#define HAVE_TERMIOS_H
++#undef HAVE_SYS_TERMIOS_H
++
+ #if defined(linux) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
+ # define OSLinux
+ #elif defined(__GNU__)
+@@ -97,7 +123,11 @@
+ #include <grp.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+-#include <sys/termios.h>
++#if defined(HAVE_TERMIOS_H)
++# include <termios.h>
++#elif defined(HAVE_SYS_TERMIOS_H)
++# include <sys/termios.h>
++#endif
+ #include <fcntl.h>
+ #include <limits.h>
+ #include <assert.h>
diff --git a/sys-apps/baselayout-prefix/files/einfo-1.0.4-termcap-check.patch b/sys-apps/baselayout-prefix/files/einfo-1.0.4-termcap-check.patch
new file mode 100644
index 000000000000..61d779e47e20
--- /dev/null
+++ b/sys-apps/baselayout-prefix/files/einfo-1.0.4-termcap-check.patch
@@ -0,0 +1,83 @@
+#diff -ru einfo-1.0.4/configure.ac einfo/configure.ac
+#--- einfo-1.0.4/configure.ac 2013-10-27 17:39:07.000000000 +0100
+#+++ einfo/configure.ac 2013-10-29 18:01:51.975745907 +0100
+#@@ -22,7 +22,7 @@
+# )
+# )
+# fi
+#-AC_DEFINE([HAVE_TERMCAP], test "x$HAVE_TERMCAP" != "x",
+#+AC_DEFINE_UNQUOTED([HAVE_TERMCAP], `test "x$HAVE_TERMCAP" = "x"; echo $?`,
+# [Define if termcap.h and library exist])
+# AC_SUBST([TERMCAP_LIBS], [$HAVE_TERMCAP])
+#
+diff -ru einfo-1.0.4/configure einfo/configure
+--- einfo-1.0.4/configure 2013-10-27 17:42:20.000000000 +0100
++++ einfo/configure 2013-10-29 18:02:08.405707018 +0100
+@@ -11447,7 +11432,9 @@
+
+ fi
+
+-$as_echo "#define HAVE_TERMCAP test \"x\$HAVE_TERMCAP\" != \"x\"" >>confdefs.h
++cat >>confdefs.h <<_ACEOF
++#define HAVE_TERMCAP `test "x$HAVE_TERMCAP" = "x"; echo $?`
++_ACEOF
+
+ TERMCAP_LIBS=$HAVE_TERMCAP
+
+diff -ru einfo-1.0.4/src/libeinfo/libeinfo.c einfo/src/libeinfo/libeinfo.c
+--- einfo-1.0.4/src/libeinfo/libeinfo.c 2013-10-27 17:37:25.000000000 +0100
++++ einfo/src/libeinfo/libeinfo.c 2013-10-29 18:05:38.081876730 +0100
+@@ -50,7 +50,7 @@
+ #include <string.h>
+ #include <strings.h>
+ #include <syslog.h>
+-#ifdef HAVE_TERMCAP
++#if HAVE_TERMCAP
+ # include <termcap.h>
+ #endif
+ #include <unistd.h>
+@@ -155,7 +155,7 @@
+
+ /* Termcap buffers and pointers
+ * Static buffers suck hard, but some termcap implementations require them */
+-#ifdef HAVE_TERMCAP
++#if HAVE_TERMCAP
+ static char termcapbuf[2048];
+ static char tcapbuf[512];
+ #else
+@@ -287,7 +287,7 @@
+ }
+
+ /* Fake tgoto call - very crapy, but works for our needs */
+-#ifndef HAVE_TERMCAP
++#if !HAVE_TERMCAP
+ static char *
+ tgoto(const char *cap, int col, int line)
+ {
+@@ -363,7 +363,7 @@
+ const char *bold;
+ char tmp[100];
+ unsigned int i = 0;
+-#ifdef HAVE_TERMCAP
++#if HAVE_TERMCAP
+ char *bp;
+ #endif
+
+@@ -387,7 +387,7 @@
+ if (strcmp(term, "cons25") == 0)
+ term_is_cons25 = true;
+
+-#ifdef HAVE_TERMCAP
++#if HAVE_TERMCAP
+ /* Check termcap to see if we can do colour or not */
+ if (tgetent(termcapbuf, term) == 1) {
+ bp = tcapbuf;
+@@ -433,7 +433,7 @@
+ _me = ME;
+ if (!_up)
+ _up = UP;
+-#ifdef HAVE_TERMCAP
++#if HAVE_TERMCAP
+ }
+
+ if (!_af || !_ce || !_me || !_md || !_up) {
diff --git a/sys-apps/baselayout-prefix/metadata.xml b/sys-apps/baselayout-prefix/metadata.xml
new file mode 100644
index 000000000000..ab2f5b1d003d
--- /dev/null
+++ b/sys-apps/baselayout-prefix/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>prefix@gentoo.org</email>
+ </maintainer>
+ <use>
+ <flag name='prefix-chaining'>install in a chained Prefix environment</flag>
+ </use>
+</pkgmetadata>