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

Contents of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (show annotations) (download)
Sun Jul 5 16:05:25 2009 UTC (5 years ago) by hollow
Branch: MAIN
Changes since 1.16: +2 -2 lines
fix SUEXEC_CALLER, bug #264261

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

  ViewVC Help
Powered by ViewVC 1.1.20