/[gentoo-alt]/trunk/prefix/eclass/webapp-apache.eclass
Gentoo

Contents of /trunk/prefix/eclass/webapp-apache.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (show annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 2 months ago) by kito
File size: 3845 byte(s)
Initial eclass import from gentoo-x86
1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/webapp-apache.eclass,v 1.25 2005/07/11 15:08:06 swegener Exp $
4 #
5 # Author: Stuart Herbert <stuart@gentoo.org>
6 #
7 # Based on discussions held on gentoo-dev mailing list, and a bug report
8 # contributed by Ian Leitch <port001@w0r.mine.nu> in bug #14870,
9 # and robbat2's mod_php ebuild
10 #
11 # This package will be offically depreciated when vhost-config and
12 # webapp-config from GLEP11 are released.
13
14 IUSE="apache2"
15 DEPEND="${DEPEND} net-www/apache"
16
17 EXPORT_FUNCTIONS pkg_setup
18
19 # NOTE:
20 #
21 # It is deliberate that the functions in this eclass are called
22 # 'webapp-xxx' rather than 'webapp-apache-xxx'. This ensures
23 # that we can drop in eclasses for other web servers without
24 # having to change the ebuilds!
25
26 function webapp-apache-detect ()
27 {
28 APACHEVER=
29 has_version '=net-www/apache-1*' && APACHEVER=1 && CONFVER=
30 has_version '=net-www/apache-2*' && use apache2 && APACHEVER=2 && CONFVER=2
31 [ -z "${APACHEVER}" ] && has_version '=net-www/apache-2*' && APACHEVER=2 && CONFVER=2
32
33 if [ "${APACHEVER}+" = "+" ]; then
34 # no apache version detected
35 return 1
36 fi
37
38 APACHECONF="/etc/apache${CONFVER}/conf/apache${CONFVER}.conf"
39 APACHECONF_COMMON="/etc/apache${CONFVER}/conf/commonapache${CONFVER}.conf"
40 APACHECONF_DIR="/etc/apache${CONFVER}/conf/"
41 WEBAPP_SERVER="Apache v${APACHEVER}"
42 }
43
44 # run the function, so we know which version of apache we are using
45
46 function webapp-detect () {
47 webapp-apache-detect || return 1
48 webapp-determine-installowner
49 webapp-determine-htdocsdir
50 webapp-determine-cgibindir
51
52 # explicit return here to ensure the return code
53 # from webapp-determine-cgibindir above isn't returned instead
54
55 return 0
56 }
57
58 function webapp-mkdirs () {
59 webapp-determine-htdocsdir
60 webapp-determine-cgibindir
61
62 keepdir "$HTTPD_ROOT"
63 fowners "$HTTPD_USER":"$HTTPD_GROUP" "$HTTPD_ROOT"
64 fperms 755 "$HTTPD_ROOT"
65
66 # explicit return here to ensure the return code
67 # from above isn't returned instead
68
69 return 0
70 }
71
72 function webapp-determine-htdocsdir ()
73 {
74 webapp-determine-installowner
75
76 # HTTPD_ROOT="`grep '^DocumentRoot' ${APACHECONF} | cut -d ' ' -f 2`"
77 # [ -z "${HTTPD_ROOT}" ] && HTTPD_ROOT="/home/httpd/htdocs/"
78 # temporary fix for webapps
79 HTTPD_ROOT="/var/www/localhost/htdocs/"
80 }
81
82 function webapp-determine-cgibindir ()
83 {
84 #HTTPD_CGIBIN="`grep 'ScriptAlias /cgi-bin/' ${APACHECONF_COMMON} | cut -d ' ' -f 7`"
85 #[ -z "${HTTPD_CGIBIN}" ] && HTTPD_CGIBIN="/home/httpd/cgi-bin/"
86 # temporary fix for webapps
87 HTTPD_CGIBIN="/var/www/localhost/cgi-bin/"
88 }
89
90 function webapp-determine-installowner ()
91 {
92 HTTPD_USER="apache"
93 HTTPD_GROUP="apache"
94 }
95
96
97 function webapp-pkg_setup ()
98 {
99 if [ "$1" == "1" ]; then
100 msg="I couldn't find an installation of Apache"
101 eerror "${msg}"
102 die "${msg}"
103 fi
104
105 ewarn "Ebuilds (like this one) that use the webapp-apache.eclass need to"
106 ewarn "be converted to use the new webapp.eclass, to be compatible with"
107 ewarn "webapp-config."
108 ewarn
109 ewarn "Please file a bug on http://bugs.gentoo.org/, stating that this"
110 ewarn "ebuild needs converting to use the new approach."
111 }
112
113 # shamelessly stolen from Max Kalika <max@gentoo.org>'s horde stuff ;-)
114 #
115 # call this from your ebuild's pkg_setup() function!!
116
117 function webapp-check-php ()
118 {
119 local missing=""
120 local php_use="$(</var/db/pkg/`best_version dev-php/mod_php`/USE)"
121 local i
122
123 for i in $* ; do
124 if [ ! "`has ${i} ${php_use}`" ] ; then
125 missing="${missing} ${i}"
126 fi
127 done
128
129 # let's tell the user how to fix these problems
130
131 if [ -n "${missing}" ]; then
132 eerror "PHP is missing support for one or more options:"
133 eerror " ${missing}"
134 eerror
135 eerror "Please add '${missing}' to your USE flags, and re-install mod_php"
136 die "mod_php needs re-compiling with missing options"
137 fi
138
139 return 0
140 }

  ViewVC Help
Powered by ViewVC 1.1.20