diff options
author | Stuart Herbert <stuart@gentoo.org> | 2004-07-16 10:48:22 +0000 |
---|---|---|
committer | Stuart Herbert <stuart@gentoo.org> | 2004-07-16 10:48:22 +0000 |
commit | 9a55471fa3b5080cda248b3d38728cacb36b5308 (patch) | |
tree | 1b5906797b18858fee6689b9dbb618f89225efa9 /eclass/depend.apache.eclass | |
parent | Stable on alpha, requested in bug #56088. (Manifest recommit) (diff) | |
download | gentoo-2-9a55471fa3b5080cda248b3d38728cacb36b5308.tar.gz gentoo-2-9a55471fa3b5080cda248b3d38728cacb36b5308.tar.bz2 gentoo-2-9a55471fa3b5080cda248b3d38728cacb36b5308.zip |
Initial import
Diffstat (limited to 'eclass/depend.apache.eclass')
-rw-r--r-- | eclass/depend.apache.eclass | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/eclass/depend.apache.eclass b/eclass/depend.apache.eclass new file mode 100644 index 000000000000..462aa26ae7f7 --- /dev/null +++ b/eclass/depend.apache.eclass @@ -0,0 +1,81 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/depend.apache.eclass,v 1.1 2004/07/16 10:48:22 stuart Exp $ + +ECLASS="depend.apache" +INHERITED="$INHERITED $ECLASS" +IUSE="apache apache2" + +# call this function to work out which version of the apache web server +# your ebuild should be installing itself to use + +detect_apache_useflags() { + USE_APACHE1= + USE_APACHE2= + USE_APACHE_MULTIPLE= + + useq apache2 && USE_APACHE2=1 + useq apache && USE_APACHE1=1 + + [ -n "$USE_APACHE1" ] && [ -n "$USE_APACHE2" ] && USE_APACHE_MULTIPLE=1 +} + +detect_apache_installed() { + HAS_APACHE1= + HAS_APACHE2= + HAS_APACHE_MULTIPLE= + HAS_APACHE_ANY= + + has_version '=net-www/apache-1*' && HAS_APACHE1=1 && HAS_APACHE_ANY=1 + has_version '=net-www/apache-2*' && HAS_APACHE2=1 && HAS_APACHE_ANY=1 + + [ -n "${HAVE_APACHE1}" ] && [ -n "${HAVE_APACHE2}" && HAVE_APACHE_MULTIPLE=1 +} + +# call this function from your pkg_setup + +depend_apache() { + detect_apache_installed + detect_apache_useflags + + # deal with the multiple cases first - much easier + if [ -n "$USE_APACHE_MULTIPLE" ]; then + echo + eerror "You have both the apache and apache2 USE flags set" + eerror + eerror "Please set only ONE of these USE flags, and try again" + echo + die "Multiple Apache USE flags set - you can only have one set at a time" + fi + + if [ -n "$USE_APACHE2" ] ; then + if [ -z "$HAS_APACHE2" -a -n "$HAS_APACHE_ANY" ] ; then + echo + eerror "You have the 'apache2' USE flag set, but only have Apache v1 installed" + eerror "If you really meant to upgrade to Apache v2, please install Apache v2" + eerror "before installing $CATEGORY/${PN}-${PVR}" + echo + die "Automatic upgrade of Apache would be forced; avoiding" + else + einfo "Apache 2 support enabled" + DETECT_APACHE=2 + return + fi + fi + + if [ -n "$USE_APACHE1" ]; then + if [ -z "$HAS_APACHE1" -a -n "$HAS_APACHE_ANY" ]; then + echo + eerror "You have the 'apache' USE flag set, but only have a later version of" + eerror "Apache installed on your computer. Please use the 'apache2' USE flag" + eerror "or downgrade to Apache v1 before installing $CATEGORY/${PN}-${PVR}" + echo + die "Avoiding installing older version of Apache" + else + einfo "Apache 1 support enabled" + DETECT_APACHE=1 + return + fi + fi +} + |