/[gentoo-x86]/eclass/apache-2.eclass
Gentoo

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.20 - (hide annotations) (download)
Fri Mar 5 09:01:07 2010 UTC (4 years, 9 months ago) by hollow
Branch: MAIN
Changes since 1.19: +2 -2 lines
do not install magic file unconditionally wrt #307747

1 hollow 1.1 # Copyright 1999-2007 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 hollow 1.20 # $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.19 2009/10/04 15:00:45 ssuominen Exp $
4 hollow 1.18
5     EAPI="2"
6 hollow 1.1
7 hollow 1.10 # @ECLASS: apache-2.eclass
8     # @MAINTAINER:
9     # apache-devs@gentoo.org
10 hollow 1.11 # @BLURB: Provides a common set of functions for apache-2.x ebuilds
11 hollow 1.1 # @DESCRIPTION:
12 hollow 1.11 # This eclass handles apache-2.x ebuild functions such as LoadModule generation
13     # and inter-module dependency checking.
14 hollow 1.1
15 hollow 1.18 inherit autotools eutils flag-o-matic multilib ssl-cert
16 hollow 1.1
17     # ==============================================================================
18     # INTERNAL VARIABLES
19     # ==============================================================================
20    
21     # @ECLASS-VARIABLE: GENTOO_PATCHNAME
22     # @DESCRIPTION:
23 robbat2 1.14 # This internal variable contains the prefix for the patch tarball.
24 robbat2 1.15 # Defaults to the full name and version (including revision) of the package.
25     # If you want to override this in an ebuild, use:
26     # ORIG_PR="(revision of Gentoo stuff you want)"
27     # GENTOO_PATCHNAME="gentoo-${PN}-${PV}${ORIG_PR:+-${ORIG_PR}}"
28 robbat2 1.14 [[ -n "$GENTOO_PATCHNAME" ]] || GENTOO_PATCHNAME="gentoo-${PF}"
29 hollow 1.1
30     # @ECLASS-VARIABLE: GENTOO_PATCHDIR
31     # @DESCRIPTION:
32     # This internal variable contains the working directory where patches and config
33 robbat2 1.14 # files are located.
34     # Defaults to the patchset name appended to the working directory.
35     [[ -n "$GENTOO_PATCHDIR" ]] || GENTOO_PATCHDIR="${WORKDIR}/${GENTOO_PATCHNAME}"
36 hollow 1.1
37 hollow 1.9 # @VARIABLE: GENTOO_DEVELOPER
38 hollow 1.1 # @DESCRIPTION:
39     # This variable needs to be set in the ebuild and contains the name of the
40     # gentoo developer who created the patch tarball
41    
42 hollow 1.9 # @VARIABLE: GENTOO_PATCHSTAMP
43 hollow 1.1 # @DESCRIPTION:
44     # This variable needs to be set in the ebuild and contains the date the patch
45 hollow 1.7 # tarball was created at in YYYYMMDD format
46 hollow 1.1
47 robbat2 1.14 # @VARIABLE: GENTOO_PATCH_A
48     # @DESCRIPTION:
49     # This variable should contain the entire filename of patch tarball.
50     # Defaults to the name of the patchset, with a datestamp.
51     [[ -n "$GENTOO_PATCH_A" ]] || GENTOO_PATCH_A="${GENTOO_PATCHNAME}-${GENTOO_PATCHSTAMP}.tar.bz2"
52    
53 hollow 1.1 SRC_URI="mirror://apache/httpd/httpd-${PV}.tar.bz2
54 robbat2 1.14 http://dev.gentoo.org/~${GENTOO_DEVELOPER}/dist/apache/${GENTOO_PATCH_A}"
55 hollow 1.1
56 hollow 1.9 # @VARIABLE: IUSE_MPMS_FORK
57 hollow 1.1 # @DESCRIPTION:
58     # This variable needs to be set in the ebuild and contains a list of forking
59 hollow 1.11 # (i.e. non-threaded) MPMs
60 hollow 1.1
61 hollow 1.9 # @VARIABLE: IUSE_MPMS_THREAD
62 hollow 1.1 # @DESCRIPTION:
63     # This variable needs to be set in the ebuild and contains a list of threaded
64 hollow 1.11 # MPMs
65 hollow 1.1
66 hollow 1.9 # @VARIABLE: IUSE_MODULES
67 hollow 1.1 # @DESCRIPTION:
68     # This variable needs to be set in the ebuild and contains a list of available
69     # built-in modules
70    
71     IUSE_MPMS="${IUSE_MPMS_FORK} ${IUSE_MPMS_THREAD}"
72 hollow 1.3 IUSE="${IUSE} debug doc ldap selinux ssl static suexec threads"
73 hollow 1.1
74     for module in ${IUSE_MODULES} ; do
75     IUSE="${IUSE} apache2_modules_${module}"
76     done
77    
78     for mpm in ${IUSE_MPMS} ; do
79     IUSE="${IUSE} apache2_mpms_${mpm}"
80     done
81    
82     DEPEND="dev-lang/perl
83     =dev-libs/apr-1*
84 hollow 1.18 =dev-libs/apr-util-1*[ldap?]
85 hollow 1.1 dev-libs/libpcre
86     ldap? ( =net-nds/openldap-2* )
87     selinux? ( sec-policy/selinux-apache )
88 hollow 1.7 ssl? ( >=dev-libs/openssl-0.9.8f )
89 hollow 1.1 !=www-servers/apache-1*"
90     RDEPEND="${DEPEND}"
91     PDEPEND="~app-admin/apache-tools-${PV}"
92    
93     S="${WORKDIR}/httpd-${PV}"
94    
95     # ==============================================================================
96     # INTERNAL FUNCTIONS
97     # ==============================================================================
98    
99     # @ECLASS-VARIABLE: MY_MPM
100 hollow 1.7 # @DESCRIPTION:
101 hollow 1.1 # This internal variable contains the selected MPM after a call to setup_mpm()
102    
103     # @FUNCTION: setup_mpm
104     # @DESCRIPTION:
105     # This internal function makes sure that only one of APACHE2_MPMS was selected
106     # or a default based on USE=threads is selected if APACHE2_MPMS is empty
107     setup_mpm() {
108 zmedico 1.4 MY_MPM=""
109 hollow 1.1 for x in ${IUSE_MPMS} ; do
110     if use apache2_mpms_${x} ; then
111     if [[ -z "${MY_MPM}" ]] ; then
112     MY_MPM=${x}
113     elog
114     elog "Selected MPM: ${MY_MPM}"
115     elog
116     else
117     eerror "You have selected more then one mpm USE-flag."
118     eerror "Only one MPM is supported."
119     die "more then one mpm was specified"
120     fi
121     fi
122     done
123    
124     if [[ -z "${MY_MPM}" ]] ; then
125     if use threads ; then
126     MY_MPM=worker
127     elog
128     elog "Selected default threaded MPM: ${MY_MPM}"
129     elog
130     else
131     MY_MPM=prefork
132     elog
133     elog "Selected default MPM: ${MY_MPM}"
134     elog
135     fi
136     fi
137    
138     if has ${MY_MPM} ${IUSE_MPMS_THREAD} && ! use threads ; then
139     eerror "You have selected a threaded MPM but USE=threads is disabled"
140     die "invalid use flag combination"
141     fi
142    
143     if has ${MY_MPM} ${IUSE_MPMS_FORK} && use threads ; then
144     eerror "You have selected a non-threaded MPM but USE=threads is enabled"
145     die "invalid use flag combination"
146     fi
147     }
148    
149 hollow 1.9 # @VARIABLE: MODULE_CRITICAL
150 hollow 1.3 # @DESCRIPTION:
151     # This variable needs to be set in the ebuild and contains a space-separated
152     # list of modules critical for the default apache. A user may still
153     # disable these modules for custom minimal installation at their own risk.
154    
155     # @FUNCTION: check_module_critical
156     # @DESCRIPTION:
157     # This internal function warns the user about modules critical for the default
158     # apache configuration.
159     check_module_critical() {
160     local unsupported=0
161    
162     for m in ${MODULE_CRITICAL} ; do
163     if ! has ${m} ${MY_MODS} ; then
164     ewarn "Module '${m}' is required in the default apache configuration."
165     unsupported=1
166     fi
167     done
168    
169     if [[ ${unsupported} -ne 0 ]] ; then
170     ewarn
171     ewarn "You have disabled one or more required modules"
172     ewarn "for the default apache configuration."
173     ewarn "Although this is not an error, please be"
174     ewarn "aware that this setup is UNSUPPORTED."
175     ewarn
176     ebeep 10
177     fi
178     }
179    
180 hollow 1.9 # @VARIABLE: MODULE_DEPENDS
181 hollow 1.1 # @DESCRIPTION:
182     # This variable needs to be set in the ebuild and contains a space-separated
183     # list of dependency tokens each with a module and the module it depends on
184     # separated by a colon
185    
186     # @FUNCTION: check_module_depends
187     # @DESCRIPTION:
188     # This internal function makes sure that all inter-module dependencies are
189     # satisfied with the current module selection
190     check_module_depends() {
191     local err=0
192    
193     for m in ${MY_MODS} ; do
194     for dep in ${MODULE_DEPENDS} ; do
195 hollow 1.7 if [[ "${m}" == "${dep%:*}" ]] ; then
196 hollow 1.1 if ! use apache2_modules_${dep#*:} ; then
197     eerror "Module '${m}' depends on '${dep#*:}'"
198     err=1
199     fi
200     fi
201     done
202     done
203    
204     if [[ ${err} -ne 0 ]] ; then
205     die "invalid use flag combination"
206     fi
207     }
208    
209     # @ECLASS-VARIABLE: MY_CONF
210 hollow 1.8 # @DESCRIPTION:
211 hollow 1.1 # This internal variable contains the econf options for the current module
212     # selection after a call to setup_modules()
213    
214     # @ECLASS-VARIABLE: MY_MODS
215 hollow 1.8 # @DESCRIPTION:
216 hollow 1.1 # This internal variable contains a sorted, space separated list of currently
217     # selected modules after a call to setup_modules()
218    
219     # @FUNCTION: setup_modules
220     # @DESCRIPTION:
221     # This internal function selects all built-in modules based on USE flags and
222     # APACHE2_MODULES USE_EXPAND flags
223     setup_modules() {
224     local mod_type=
225    
226     if use static ; then
227     mod_type="static"
228     else
229     mod_type="shared"
230     fi
231    
232     MY_CONF="--enable-so=static"
233    
234     if use ldap ; then
235     MY_CONF="${MY_CONF} --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}"
236     MY_MODS="${MY_MODS} ldap authnz_ldap"
237     else
238     MY_CONF="${MY_CONF} --disable-authnz_ldap --disable-ldap"
239     fi
240    
241     if use ssl ; then
242     MY_CONF="${MY_CONF} --with-ssl=/usr --enable-ssl=${mod_type}"
243     MY_MODS="${MY_MODS} ssl"
244     else
245     MY_CONF="${MY_CONF} --without-ssl --disable-ssl"
246     fi
247    
248     if use threads || has ${MY_MPM} ${IUSE_MPMS_THREAD} ; then
249     MY_CONF="${MY_CONF} --enable-cgid=${mod_type}"
250     MY_MODS="${MY_MODS} cgid"
251     else
252     MY_CONF="${MY_CONF} --enable-cgi=${mod_type}"
253     MY_MODS="${MY_MODS} cgi"
254     fi
255    
256     if use suexec ; then
257     elog "You can manipulate several configure options of suexec"
258     elog "through the following environment variables:"
259     elog
260     elog " SUEXEC_SAFEPATH: Default PATH for suexec (default: /usr/local/bin:/usr/bin:/bin)"
261     elog " SUEXEC_LOGFILE: Path to the suexec logfile (default: /var/log/apache2/suexec_log)"
262     elog " SUEXEC_CALLER: Name of the user Apache is running as (default: apache)"
263     elog " SUEXEC_DOCROOT: Directory in which suexec will run scripts (default: /var/www)"
264     elog " SUEXEC_MINUID: Minimum UID, which is allowed to run scripts via suexec (default: 1000)"
265     elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)"
266     elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
267     elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
268     elog
269    
270     MY_CONF="${MY_CONF} --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}"
271     MY_CONF="${MY_CONF} --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}"
272     MY_CONF="${MY_CONF} --with-suexec-bin=/usr/sbin/suexec"
273     MY_CONF="${MY_CONF} --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}"
274     MY_CONF="${MY_CONF} --with-suexec-caller=${SUEXEC_CALLER:-apache}"
275     MY_CONF="${MY_CONF} --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}"
276     MY_CONF="${MY_CONF} --with-suexec-uidmin=${SUEXEC_MINUID:-1000}"
277     MY_CONF="${MY_CONF} --with-suexec-gidmin=${SUEXEC_MINGID:-100}"
278     MY_CONF="${MY_CONF} --with-suexec-umask=${SUEXEC_UMASK:-077}"
279     MY_CONF="${MY_CONF} --enable-suexec=${mod_type}"
280     MY_MODS="${MY_MODS} suexec"
281     else
282     MY_CONF="${MY_CONF} --disable-suexec"
283     fi
284    
285     for x in ${IUSE_MODULES} ; do
286     if use apache2_modules_${x} ; then
287     MY_CONF="${MY_CONF} --enable-${x}=${mod_type}"
288     MY_MODS="${MY_MODS} ${x}"
289     else
290     MY_CONF="${MY_CONF} --disable-${x}"
291     fi
292     done
293    
294     # sort and uniquify MY_MODS
295     MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u)
296     check_module_depends
297 hollow 1.3 check_module_critical
298 hollow 1.1 }
299    
300 hollow 1.9 # @VARIABLE: MODULE_DEFINES
301 hollow 1.1 # @DESCRIPTION:
302     # This variable needs to be set in the ebuild and contains a space-separated
303     # list of tokens each mapping a module to a runtime define which can be
304     # specified in APACHE2_OPTS in /etc/conf.d/apache2 to enable this particular
305     # module.
306    
307     # @FUNCTION: generate_load_module
308     # @DESCRIPTION:
309     # This internal function generates the LoadModule lines for httpd.conf based on
310     # the current module selection and MODULE_DEFINES
311     generate_load_module() {
312 hollow 1.8 local endit=0 mod_lines= mod_dir="${D}/usr/$(get_libdir)/apache2/modules"
313 hollow 1.1
314     if use static; then
315     sed -i -e "/%%LOAD_MODULE%%/d" \
316     "${GENTOO_PATCHDIR}"/conf/httpd.conf
317     return
318     fi
319    
320     for m in ${MY_MODS} ; do
321     if [[ -e "${mod_dir}/mod_${m}.so" ]] ; then
322     for def in ${MODULE_DEFINES} ; do
323     if [[ "${m}" == "${def%:*}" ]] ; then
324     mod_lines="${mod_lines}\n<IfDefine ${def#*:}>"
325     endit=1
326     fi
327     done
328    
329     mod_lines="${mod_lines}\nLoadModule ${m}_module modules/mod_${m}.so"
330    
331     if [[ ${endit} -ne 0 ]] ; then
332     mod_lines="${mod_lines}\n</IfDefine>"
333     endit=0
334     fi
335     fi
336     done
337    
338     sed -i -e "s:%%LOAD_MODULE%%:${mod_lines}:" \
339     "${GENTOO_PATCHDIR}"/conf/httpd.conf
340     }
341    
342     # @FUNCTION: check_upgrade
343     # @DESCRIPTION:
344     # This internal function checks if the previous configuration file for built-in
345     # modules exists in ROOT and prevents upgrade in this case. Users are supposed
346     # to convert this file to the new APACHE2_MODULES USE_EXPAND variable and remove
347     # it afterwards.
348     check_upgrade() {
349     if [[ -e "${ROOT}"etc/apache2/apache2-builtin-mods ]]; then
350     eerror "The previous configuration file for built-in modules"
351     eerror "(${ROOT}etc/apache2/apache2-builtin-mods) exists on your"
352     eerror "system."
353     eerror
354 hollow 1.2 eerror "Please read http://www.gentoo.org/doc/en/apache-upgrading.xml"
355 hollow 1.1 eerror "for detailed information how to convert this file to the new"
356     eerror "APACHE2_MODULES USE_EXPAND variable."
357     eerror
358     die "upgrade not possible with existing ${ROOT}etc/apache2/apache2-builtin-mods"
359     fi
360     }
361    
362     # ==============================================================================
363     # EXPORTED FUNCTIONS
364     # ==============================================================================
365    
366     # @FUNCTION: apache-2_pkg_setup
367     # @DESCRIPTION:
368     # This function selects built-in modules, the MPM and other configure options,
369     # creates the apache user and group and informs about CONFIG_SYSVIPC being
370     # needed (we don't depend on kernel sources and therefore cannot check).
371     apache-2_pkg_setup() {
372     check_upgrade
373    
374 hollow 1.11 # setup apache user and group
375     enewgroup apache 81
376     enewuser apache 81 -1 /var/www apache
377    
378 hollow 1.1 setup_mpm
379     setup_modules
380    
381     if use debug; then
382     MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook"
383     fi
384    
385     elog "Please note that you need SysV IPC support in your kernel."
386     elog "Make sure CONFIG_SYSVIPC=y is set."
387     elog
388 hollow 1.12
389     if use userland_BSD; then
390     elog "On BSD systems you need to add the following line to /boot/loader.conf:"
391     elog " accf_http_load=\"YES\""
392     elog
393     fi
394 hollow 1.1 }
395    
396 hollow 1.18 # @FUNCTION: apache-2_src_prepare
397 hollow 1.1 # @DESCRIPTION:
398     # This function applies patches, configures a custom file-system layout and
399 hollow 1.3 # rebuilds the configure scripts.
400 hollow 1.18 apache-2_src_prepare() {
401 grobian 1.16 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
402     # idea for everyone
403     case ${CHOST} in
404     *-linux-gnu|*-solaris*|*-freebsd*)
405     # do nothing, these use GNU binutils
406     :
407     ;;
408     *-darwin*)
409     sed -i -e 's/-Wl,-z,now/-Wl,-bind_at_load/g' \
410     "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
411     ;;
412     *)
413     # patch it out to be like upstream
414     sed -i -e 's/-Wl,-z,now//g' \
415     "${GENTOO_PATCHDIR}"/patches/03_all_gentoo_apache-tools.patch
416     ;;
417     esac
418    
419 hollow 1.1 # Use correct multilib libdir in gentoo patches
420     sed -i -e "s:/usr/lib:/usr/$(get_libdir):g" \
421     "${GENTOO_PATCHDIR}"/{conf/httpd.conf,init/*,patches/config.layout} \
422     || die "libdir sed failed"
423    
424     epatch "${GENTOO_PATCHDIR}"/patches/*.patch
425    
426     # setup the filesystem layout config
427     cat "${GENTOO_PATCHDIR}"/patches/config.layout >> "${S}"/config.layout || \
428     die "Failed preparing config.layout!"
429     sed -i -e "s:version:${PF}:g" "${S}"/config.layout
430    
431 hollow 1.3 # apache2.8 instead of httpd.8 (bug #194828)
432     mv docs/man/{httpd,apache2}.8
433     sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
434    
435 hollow 1.1 # patched-in MPMs need the build environment rebuilt
436     sed -i -e '/sinclude/d' configure.in
437     AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf
438     }
439    
440 hollow 1.18 # @FUNCTION: apache-2_src_configure
441 hollow 1.1 # @DESCRIPTION:
442     # This function adds compiler flags and runs econf and emake based on MY_MPM and
443     # MY_CONF
444 hollow 1.18 apache-2_src_configure() {
445 hollow 1.1 # Instead of filtering --as-needed (bug #128505), append --no-as-needed
446     # Thanks to Harald van Dijk
447 ssuominen 1.19 append-ldflags $(no-as-needed)
448 hollow 1.1
449     # peruser MPM debugging with -X is nearly impossible
450     if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
451     use debug && append-flags -DMPM_PERUSER_DEBUG
452     fi
453    
454     # econf overwrites the stuff from config.layout, so we have to put them into
455     # our myconf line too
456     econf \
457     --includedir=/usr/include/apache2 \
458     --libexecdir=/usr/$(get_libdir)/apache2/modules \
459     --datadir=/var/www/localhost \
460     --sysconfdir=/etc/apache2 \
461     --localstatedir=/var \
462     --with-mpm=${MY_MPM} \
463     --with-apr=/usr \
464     --with-apr-util=/usr \
465     --with-pcre=/usr \
466     --with-z=/usr \
467     --with-port=80 \
468     --with-program-name=apache2 \
469     --enable-layout=Gentoo \
470     ${MY_CONF} || die "econf failed!"
471    
472     sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
473     }
474    
475     # @FUNCTION: apache-2_src_install
476     # @DESCRIPTION:
477 hollow 1.11 # This function runs `emake install' and generates, installs and adapts the gentoo
478 hollow 1.1 # specific configuration files found in the tarball
479     apache-2_src_install() {
480 hollow 1.5 make DESTDIR="${D}" install || die "make install failed"
481 hollow 1.1
482     # install our configuration files
483     keepdir /etc/apache2/vhosts.d
484     keepdir /etc/apache2/modules.d
485    
486     generate_load_module
487     insinto /etc/apache2
488     doins -r "${GENTOO_PATCHDIR}"/conf/*
489 hollow 1.20 use apache2_modules_mime_magic && doins docs/conf/magic
490 hollow 1.1
491     insinto /etc/logrotate.d
492     newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
493    
494     # generate a sane default APACHE2_OPTS
495 hollow 1.18 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
496 hollow 1.1 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
497     use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
498     use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
499 hollow 1.18 if hasq negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
500     APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
501     fi
502 hollow 1.1
503     sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
504     "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
505    
506     newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
507     newinitd "${GENTOO_PATCHDIR}"/init/apache2.initd apache2
508    
509 hollow 1.13 # install apache2ctl wrapper for our init script if available
510     if test -e "${GENTOO_PATCHDIR}"/scripts/apache2ctl; then
511     exeinto /usr/sbin
512     doexe "${GENTOO_PATCHDIR}"/scripts/apache2ctl
513     else
514     dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
515     fi
516 hollow 1.1
517 hollow 1.6 # provide legacy symlink for apxs, bug 177697
518     dosym /usr/sbin/apxs /usr/sbin/apxs2
519 hollow 1.1
520     # install some documentation
521     dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
522     dodoc "${GENTOO_PATCHDIR}"/docs/*
523    
524     # drop in a convenient link to the manual
525     if use doc ; then
526     sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf"
527     else
528     rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
529     rm -Rf "${D}/usr/share/doc/${PF}/manual"
530     fi
531    
532 hollow 1.18 # the default icons and error pages get stored in
533     # /usr/share/apache2/{error,icons}
534     dodir /usr/share/apache2
535     mv -f "${D}/var/www/localhost/error" "${D}/usr/share/apache2/error"
536     mv -f "${D}/var/www/localhost/icons" "${D}/usr/share/apache2/icons"
537     rm -rf "${D}/var/www/localhost/"
538 hollow 1.1 eend $?
539    
540     # set some sane permissions for suexec
541     if use suexec ; then
542 hollow 1.17 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
543 hollow 1.1 fperms 4710 /usr/sbin/suexec
544 hollow 1.6 # provide legacy symlink for suexec, bug 177697
545     dosym /usr/sbin/suexec /usr/sbin/suexec2
546 hollow 1.1 fi
547    
548     # empty dirs
549     for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
550     keepdir ${i}
551     fowners apache:apache ${i}
552     fperms 0755 ${i}
553     done
554     }
555    
556     # @FUNCTION: apache-2_pkg_postinst
557     # @DESCRIPTION:
558     # This function creates test certificates if SSL is enabled and installs the
559 hollow 1.18 # default index.html to /var/www/localhost if it does not exist. We do this here
560 hollow 1.11 # because the default webroot is a copy of the files that exist elsewhere and we
561     # don't want them to be managed/removed by portage when apache is upgraded.
562 hollow 1.1 apache-2_pkg_postinst() {
563 hollow 1.18 if use ssl && [[ ! -e "${ROOT}/etc/ssl/apache2/server.pem" ]]; then
564     SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
565     install_cert /etc/ssl/apache2/server
566     ewarn
567     ewarn "The location of SSL certificates has changed. If you are"
568     ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
569     ewarn "*any* apache version), you might want to move your old"
570     ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
571     ewarn "update your config files."
572     ewarn
573 hollow 1.1 fi
574    
575 hollow 1.18 if [[ ! -e "${ROOT}/var/www/localhost" ]] ; then
576     mkdir -p "${ROOT}/var/www/localhost/htdocs"
577     echo "<html><body><h1>It works!</h1></body></html>" > "${ROOT}/var/www/localhost/htdocs/index.html"
578 hollow 1.1 fi
579     }
580    
581 hollow 1.18 EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20