| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Id: prefix.eclass,v 1.1 2009/04/02 17:36:53 grobian Exp $ |
3 | # $Id: prefix.eclass,v 1.2 2009/11/16 21:37:14 grobian Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: prefix.eclass |
5 | # @ECLASS: prefix.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Feel free to contact the Prefix team through <prefix@gentoo.org> if |
7 | # Feel free to contact the Prefix team through <prefix@gentoo.org> if |
| 8 | # you have problems, suggestions or questions. |
8 | # you have problems, suggestions or questions. |
| … | |
… | |
| 29 | # @DESCRIPTION: |
29 | # @DESCRIPTION: |
| 30 | # replaces @GENTOO_PORTAGE_EPREFIX@ with ${EPREFIX} for the given 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 |
31 | # dies if no arguments are given, a file does not exist, or changing a |
| 32 | # file failed. |
32 | # file failed. |
| 33 | eprefixify() { |
33 | eprefixify() { |
| 34 | [[ $# -lt 1 ]] && die "at least one argument needed" |
34 | [[ $# -lt 1 ]] && die "at least one argument required" |
| 35 | |
35 | |
| 36 | einfo "Adjusting to prefix" |
36 | einfo "Adjusting to prefix ${EPREFIX:-/}" \ |
| 37 | local x |
37 | local x |
| 38 | for x in "$@" ; do |
38 | for x in "$@" ; do |
| 39 | if [[ -e ${x} ]] ; then |
39 | if [[ -e ${x} ]] ; then |
| 40 | ebegin " ${x##*/}" |
40 | ebegin " ${x##*/}" |
| 41 | sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}" |
41 | sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}" |