1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: prefix.eclass
7 # Feel free to contact the Prefix team through <prefix@gentoo.org> if
8 # you have problems, suggestions or questions.
9 # @BLURB: Eclass to provide Prefix functionality
11 # Gentoo Prefix allows users to install into a self defined offset
12 # located somewhere in the filesystem. Prefix ebuilds require
13 # additional functions and variables which are defined by this eclass.
15 # @ECLASS-VARIABLE: EPREFIX
17 # The offset prefix of a Gentoo Prefix installation. When Gentoo Prefix
18 # is not used, ${EPREFIX} should be "". Prefix Portage sets EPREFIX,
19 # hence this eclass has nothing to do here in that case.
20 # Note that setting EPREFIX in the environment with Prefix Portage sets
21 # Portage into cross-prefix mode.
22 if [[ ! ${EPREFIX+set} ]]; then
27 # @FUNCTION: eprefixify
28 # @USAGE: <list of to be eprefixified files>
30 # replaces @GENTOO_PORTAGE_EPREFIX@ with ${EPREFIX} for the given files,
31 # dies if no arguments are given, a file does not exist, or changing a
34 [[ $# -lt 1 ]] && die "at least one argument required"
36 einfo "Adjusting to prefix ${EPREFIX:-/}"
39 if [[ -e ${x} ]] ; then
41 sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}"
42 eend $? || die "failed to eprefixify ${x}"
44 die "${x} does not exist"