summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2011-03-23 08:00:48 +0000
committerFabian Groffen <grobian@gentoo.org>2011-03-23 08:00:48 +0000
commit0e95eebe0baf629b813630a6c597662cb28c60b5 (patch)
tree2ad2d036511ff73cdd950ec5cb39c2682b35fcb4 /sys-apps/baselayout-prefix
parentVersion bump. (diff)
downloadhistorical-0e95eebe0baf629b813630a6c597662cb28c60b5.tar.gz
historical-0e95eebe0baf629b813630a6c597662cb28c60b5.tar.bz2
historical-0e95eebe0baf629b813630a6c597662cb28c60b5.zip
Move to gx86, bump for EAPI=3 and other small fixes, including bug #358823
Package-Manager: portage-2.2.01.18125-prefix/cvs/Darwin powerpc
Diffstat (limited to 'sys-apps/baselayout-prefix')
-rw-r--r--sys-apps/baselayout-prefix/ChangeLog116
-rw-r--r--sys-apps/baselayout-prefix/Manifest15
-rw-r--r--sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r9.ebuild173
-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/metadata.xml8
15 files changed, 1304 insertions, 0 deletions
diff --git a/sys-apps/baselayout-prefix/ChangeLog b/sys-apps/baselayout-prefix/ChangeLog
new file mode 100644
index 000000000000..958342e36bf7
--- /dev/null
+++ b/sys-apps/baselayout-prefix/ChangeLog
@@ -0,0 +1,116 @@
+# ChangeLog for sys-apps/baselayout-prefix
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout-prefix/ChangeLog,v 1.1 2011/03/23 08:00:48 grobian Exp $
+
+*baselayout-prefix-1.12.5-r9 (23 Mar 2011)
+
+ 23 Mar 2011; Fabian Groffen <grobian@gentoo.org>
+ +baselayout-prefix-1.12.5-r9.ebuild, +files/baselayout-1.12.5-prefix.patch,
+ +files/baselayout-1.12.5-prefix-chaining.patch,
+ +files/baselayout-1.12.5-prefix-chaining-bash.patch,
+ +files/baselayout-1.12.5-prefix-chaining-eprefix.patch,
+ +files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch,
+ +files/baselayout-1.12.5-prefix-chaining-prompt.patch,
+ +files/baselayout-1.12.5-prefix-chaining-recursion.patch,
+ +files/baselayout-1.12.5-prefix-no-consoletype.patch,
+ +files/baselayout-1.12.5-prefix-pidof.patch,
+ +files/baselayout-1.12.5-prefix-sh.patch,
+ +files/baselayout-1.12.5-prefix-src.patch, +metadata.xml:
+ Move to gx86, bump for EAPI=3 and other small fixes, including bug #358823
+
+*baselayout-prefix-1.12.5-r8 (29 Oct 2010)
+
+ 29 Oct 2010; Markus Duft <mduft@gentoo.org>
+ -baselayout-prefix-1.12.5-r7.ebuild, +baselayout-prefix-1.12.5-r8.ebuild,
+ +files/baselayout-1.12.5-prefix-chaining-bash.patch:
+ enable chained prefixes to find and use parent bash, revbump
+
+ 11 Jun 2010; Fabian Groffen <grobian@gentoo.org>
+ baselayout-prefix-1.12.5-r7.ebuild:
+ Create portage group and user for root installs, bug #321623
+
+*baselayout-prefix-1.12.5-r7 (14 May 2010)
+
+ 14 May 2010; Fabian Groffen <grobian@gentoo.org>
+ +baselayout-prefix-1.12.5-r7.ebuild,
+ +files/baselayout-1.12.5-prefix-no-consoletype.patch,
+ +files/baselayout-1.12.5-prefix-pidof.patch,
+ +files/baselayout-1.12.5-prefix-sh.patch,
+ +files/baselayout-1.12.5-prefix-src.patch:
+ Revision bump including patches from bug #196294. Probably needs some
+ finishing touches. Masked for the time being not to raise false
+ expectations.
+
+ 20 Jul 2009; Markus Duft <mduft@gentoo.org>
+ baselayout-prefix-1.12.5-r6.ebuild,
+ +files/baselayout-1.12.5-prefix-chaining-recursion.patch:
+ added patch for profile recursion, which was destroying some internal
+ information before...
+
+ 14 Jul 2009; Markus Duft <mduft@gentoo.org>
+ files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch:
+ fixed mistake in previous patch
+
+ 14 Jul 2009; Markus Duft <mduft@gentoo.org>
+ baselayout-prefix-1.12.5-r6.ebuild,
+ +files/baselayout-1.12.5-prefix-chaining-pkgconfig.patch:
+ fixed pkg-config issues with prefix-chaining
+
+*baselayout-prefix-1.12.5-r6 (26 Mar 2009)
+
+ 26 Mar 2009; <mduft@gentoo.org>
+ +files/baselayout-1.12.5-prefix-chaining.patch,
+ -baselayout-prefix-1.12.5-r5.ebuild, +baselayout-prefix-1.12.5-r6.ebuild:
+ added prefix-chaining support. usefull together with a recent/patched
+ portage, and app-portage/prefix-chain-setup.
+
+ 18 Mar 2009; Fabian Groffen <grobian@gentoo.org>
+ baselayout-prefix-1.12.5-r5.ebuild, baselayout-prefix-1.12.5-r5.ebuild:
+ inherit prefix
+
+*baselayout-prefix-1.12.5-r5 (09 Nov 2007)
+
+ 09 Nov 2007; Fabian Groffen <grobian@gentoo.org>
+ +baselayout-prefix-1.12.5-r5.ebuild:
+ Fix for bug #183874, create libdir symlinks when using a multilib profile
+
+*baselayout-prefix-1.12.5-r4 (14 May 2007)
+
+ 14 May 2007; Fabian Groffen <grobian@gentoo.org>
+ files/baselayout-1.12.5-prefix.patch, -baselayout-prefix-1.12.5-r3.ebuild,
+ +baselayout-prefix-1.12.5-r4.ebuild:
+ Change path in profile to have host-specific paths to come after prefix
+ path, such that they don't overrule e.g. opt/bin from prefix. Added sbin
+ variants to normal user PATH for prefix usage.
+
+*baselayout-prefix-1.12.5-r3 (13 Apr 2007)
+
+ 13 Apr 2007; Fabian Groffen <grobian@gentoo.org>
+ files/baselayout-1.12.5-prefix.patch, -baselayout-prefix-1.12.5-r2.ebuild,
+ +baselayout-prefix-1.12.5-r3.ebuild:
+ Add host manpath in 99basic file, such that it ends up as last in the
+ MANPATH, which is what we want
+
+*baselayout-prefix-1.12.5-r2 (03 Dec 2006)
+
+ 03 Dec 2006; Fabian Groffen <grobian@gentoo.org>
+ files/baselayout-1.12.5-prefix.patch, -baselayout-prefix-1.12.5-r1.ebuild,
+ +baselayout-prefix-1.12.5-r2.ebuild:
+ Fix manpath to include the system manpath and to not to include usr/local in
+ the prefix, as the prefix is the replacement of that.
+
+*baselayout-darwin-1.11.11-r1 (07 Aug 2005)
+
+ 07 Aug 2005; Joseph Jezak <josejx@gentoo.org>
+ +files/dont-destroy-path.patch, +baselayout-darwin-1.11.11-r1.ebuild:
+ Fixed less than stellar profile handling of PATH.
+
+ 13 May 2005; <gongloo@gentoo.org> baselayout-darwin-1.11.11.ebuild:
+ Fixed xargs command-line argument (--null to -0).
+
+*baselayout-darwin-1.11.11 (12 May 2005)
+
+ 12 May 2005; Joseph Jezak <josejx@gentoo.org> +metadata.xml,
+ +baselayout-darwin-1.11.11.ebuild:
+ Initial commit.
+
diff --git a/sys-apps/baselayout-prefix/Manifest b/sys-apps/baselayout-prefix/Manifest
new file mode 100644
index 000000000000..c871a5441c31
--- /dev/null
+++ b/sys-apps/baselayout-prefix/Manifest
@@ -0,0 +1,15 @@
+AUX baselayout-1.12.5-prefix-chaining-bash.patch 862 RMD160 f514ef370a4858f63c23cfbef9bdbb59c074e50d SHA1 70b02ea0148dd43df2012de2413aef505051b87c SHA256 0fe5200752a3c6437e17f833b307e8dbebaa6c3786adf9814f060445f702550b
+AUX baselayout-1.12.5-prefix-chaining-eprefix.patch 991 RMD160 74c0326b2800a9b6c9670550fab3ddfbf42bb9d0 SHA1 0593cc4963b9611159e0a791f8743702ab875883 SHA256 1d6b1f66f2bbf5417d36808ab8bce951a9ecdbcf4992ffb3fcd32af8a6e7b048
+AUX baselayout-1.12.5-prefix-chaining-pkgconfig.patch 568 RMD160 ec1dc56f66f3cceb7afe1695f2e887299f430d97 SHA1 51fa2775a998a1519253213cb62d5db980d18cc4 SHA256 6c7cdea50afc178693b954bf295dfe1de7fa06108f662f5aa0d539c69ba1f28f
+AUX baselayout-1.12.5-prefix-chaining-prompt.patch 2300 RMD160 1a43e398fa5273c01dff4494ec7b71dd25c22fe7 SHA1 967fc7f71dc2668ae85bb53e354d48e839e3e733 SHA256 4b1725e97e6686c0bfdf35bb79afaff879daf253752c1f8e371ecf472745a51b
+AUX baselayout-1.12.5-prefix-chaining-recursion.patch 1094 RMD160 e024149f922200659ba26a155ff0cae64d938ad4 SHA1 c5756f2af1acc977ed97d5c08de801d75d58006a SHA256 662f2d8d1187e7b51d1dc85963968c7a4643bff5ff152a232263affcf1b7e45a
+AUX baselayout-1.12.5-prefix-chaining.patch 3110 RMD160 f05af529f05eeb1436d9f293d0d2ff610b66230d SHA1 719adaa77c1c64dc0bbc877b97d3d17158eb1cb5 SHA256 6c0a78fbea15ed92fcc3088f13670ab42e95c452b31263d8f1d71a9707452c91
+AUX baselayout-1.12.5-prefix-no-consoletype.patch 343 RMD160 68fe971987855a9c091f3be661074c54f81200fa SHA1 47637bd741615d1d52489d4094e81908f29e8b86 SHA256 0e80a3e038df327c376ce4105bbb4cc1f93cacdbbd364d4f9d0a2ead9952928c
+AUX baselayout-1.12.5-prefix-pidof.patch 329 RMD160 eca62253ec62c3c88b8e95a9fef7c5e5115fec6b SHA1 6698cf2b4df982bef2b11047a04dcad03c09bdf1 SHA256 696838d0866d19db7503fd39f4ab7388dfc6bcd46c3273aa5f420f76c60f99b7
+AUX baselayout-1.12.5-prefix-sh.patch 8171 RMD160 c85d0c98d5cf7539571f13a40fa27cbe547d3439 SHA1 121d9ec49256f2bbeae18ccaa3cea22a9168db50 SHA256 aed4b37186ec24ea5189e5be20f1a05cf76f277054a6a5761195ef803b88acad
+AUX baselayout-1.12.5-prefix-src.patch 3629 RMD160 cda870fae2abf559770d0ac7e5d00a4657906ba5 SHA1 27bec4c8f878b1d5c8a2c5cf8c646a818d01a175 SHA256 3f7565deda1f82e5906b350c178b8b414a2b37f8155439e0c6f2689c76ca2ba3
+AUX baselayout-1.12.5-prefix.patch 14807 RMD160 5be4ca65ee754d1c95bb00c488ddd5a77240e9fe SHA1 24d4677f7ade70a712ef73fde33db5b82da39f45 SHA256 a79a3d2f35e03e75c858ef81ccada82b3de4b5bb96168386a1f652bac198ad6c
+DIST baselayout-1.12.5.tar.bz2 220693 RMD160 85f03fe3b0ff0521ec4226a1b6788575052923b7 SHA1 39ef351ceec1238cbf27d7b9671f244ccf5cca33 SHA256 4ab5512f35c547549b0406221ed92c71a5a86a11044f1d9f0d87f7ec44d39817
+EBUILD baselayout-prefix-1.12.5-r9.ebuild 5545 RMD160 4fdaad16e4137d68669fbfa026221b60986582ed SHA1 07fcea6815d2c4123a57d72de748f692c151e70c SHA256 a95491aba321a12e08839bd401467412ab54930de7f5a39da6a679bf1ddcaf66
+MISC ChangeLog 4770 RMD160 55803b0a9c7400e53918518be42a16a894bb741e SHA1 242a58b62167bd0bf771010270dbcfae0d1af20a SHA256 e79c10e3925a0f983d14158703a68c684a557c56d2f109784dead716b80cbc0d
+MISC metadata.xml 225 RMD160 d9a99d8e09a2a2b307adf488743503c3ec3114f2 SHA1 766c26d22247828fcaa56dfc73f49d3b6fab5f83 SHA256 8ba85d3837af45269d5a9dcc52e29659961cabb3fff903f54260598f54ed82ad
diff --git a/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r9.ebuild b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r9.ebuild
new file mode 100644
index 000000000000..a64c50d58696
--- /dev/null
+++ b/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r9.ebuild
@@ -0,0 +1,173 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout-prefix/baselayout-prefix-1.12.5-r9.ebuild,v 1.1 2011/03/23 08:00:48 grobian Exp $
+
+EAPI=3
+
+inherit eutils toolchain-funcs multilib prefix
+
+DESCRIPTION="Minimal baselayout for Gentoo Prefix installs"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI="http://dev.gentoo.org/~grobian/distfiles/${P/-prefix/}.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
+ userland_Darwin? ( sys-process/pidof-bsd )
+ userland_FreeBSD? ( sys-process/pidof-bsd )"
+
+S=${WORKDIR}/${P/-prefix}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix.patch
+
+ if use prefix-chaining; then
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining.patch
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-pkgconfig.patch
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-recursion.patch
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-eprefix.patch
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-prompt.patch
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-chaining-bash.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
+
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-src.patch
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-sh.patch
+ # Next patch is to be applied on systems that don't have a pidof.
+ epatch "${FILESDIR}"/${P/-prefix/}-prefix-pidof.patch
+ # 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_compile() {
+ 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/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/metadata.xml b/sys-apps/baselayout-prefix/metadata.xml
new file mode 100644
index 000000000000..0edece6c841f
--- /dev/null
+++ b/sys-apps/baselayout-prefix/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>no-herd</herd>
+ <maintainer>
+ <email>prefix@gentoo.org</email>
+ </maintainer>
+</pkgmetadata>