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

Diff of /eclass/apache-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.16 Revision 1.36
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2014 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# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.16 2009/04/04 17:50:51 grobian Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/apache-2.eclass,v 1.36 2014/05/22 13:58:46 polynomial-c Exp $
4 4
5# @ECLASS: apache-2.eclass 5# @ECLASS: apache-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# apache-devs@gentoo.org 7# apache-devs@gentoo.org
8# @BLURB: Provides a common set of functions for apache-2.x ebuilds 8# @BLURB: Provides a common set of functions for apache-2.x ebuilds
9# @DESCRIPTION: 9# @DESCRIPTION:
10# This eclass handles apache-2.x ebuild functions such as LoadModule generation 10# This eclass handles apache-2.x ebuild functions such as LoadModule generation
11# and inter-module dependency checking. 11# and inter-module dependency checking.
12 12
13inherit autotools confutils eutils flag-o-matic multilib 13inherit autotools eutils flag-o-matic multilib ssl-cert user toolchain-funcs versionator
14
15[[ ${CATEGORY}/${PN} != www-servers/apache ]] \
16 && die "Do not use this eclass with anything else than www-servers/apache ebuilds!"
17
18case ${EAPI:-0} in
19 0|1|2|3)
20 die "This eclass requires >=EAPI-4"
21 ;;
22esac
23
24# settings which are version specific go in here:
25case $(get_version_component_range 1-2) in
26 2.4)
27 DEFAULT_MPM_THREADED="event" #509922
28 RDEPEND=">=dev-libs/apr-1.5.1" #492578
29 ;;
30 *)
31 DEFAULT_MPM_THREADED="worker"
32 RDEPEND=">=dev-libs/apr-1.4.5" #368651
33 ;;
34esac
14 35
15# ============================================================================== 36# ==============================================================================
16# INTERNAL VARIABLES 37# INTERNAL VARIABLES
17# ============================================================================== 38# ==============================================================================
18 39
77 IUSE="${IUSE} apache2_mpms_${mpm}" 98 IUSE="${IUSE} apache2_mpms_${mpm}"
78done 99done
79 100
80DEPEND="dev-lang/perl 101DEPEND="dev-lang/perl
81 =dev-libs/apr-1* 102 =dev-libs/apr-1*
82 =dev-libs/apr-util-1* 103 =dev-libs/apr-util-1*[ldap?]
83 dev-libs/libpcre 104 dev-libs/libpcre
105 apache2_modules_deflate? ( sys-libs/zlib )
106 apache2_modules_mime? ( app-misc/mime-types )
84 ldap? ( =net-nds/openldap-2* ) 107 ldap? ( =net-nds/openldap-2* )
85 selinux? ( sec-policy/selinux-apache ) 108 selinux? ( sec-policy/selinux-apache )
86 ssl? ( >=dev-libs/openssl-0.9.8f ) 109 ssl? ( >=dev-libs/openssl-0.9.8m )
87 !=www-servers/apache-1*" 110 !=www-servers/apache-1*"
88RDEPEND="${DEPEND}" 111RDEPEND+=" ${DEPEND}"
89PDEPEND="~app-admin/apache-tools-${PV}" 112PDEPEND="~app-admin/apache-tools-${PV}"
90 113
91S="${WORKDIR}/httpd-${PV}" 114S="${WORKDIR}/httpd-${PV}"
92 115
93# ============================================================================== 116# ==============================================================================
119 fi 142 fi
120 done 143 done
121 144
122 if [[ -z "${MY_MPM}" ]] ; then 145 if [[ -z "${MY_MPM}" ]] ; then
123 if use threads ; then 146 if use threads ; then
124 MY_MPM=worker 147 MY_MPM=${DEFAULT_MPM_THREADED}
125 elog 148 elog
126 elog "Selected default threaded MPM: ${MY_MPM}" 149 elog "Selected default threaded MPM: ${MY_MPM}"
127 elog 150 elog
128 else 151 else
129 MY_MPM=prefork 152 MY_MPM=prefork
169 ewarn "You have disabled one or more required modules" 192 ewarn "You have disabled one or more required modules"
170 ewarn "for the default apache configuration." 193 ewarn "for the default apache configuration."
171 ewarn "Although this is not an error, please be" 194 ewarn "Although this is not an error, please be"
172 ewarn "aware that this setup is UNSUPPORTED." 195 ewarn "aware that this setup is UNSUPPORTED."
173 ewarn 196 ewarn
174 ebeep 10
175 fi 197 fi
176} 198}
177 199
178# @VARIABLE: MODULE_DEPENDS 200# @VARIABLE: MODULE_DEPENDS
179# @DESCRIPTION: 201# @DESCRIPTION:
228 fi 250 fi
229 251
230 MY_CONF="--enable-so=static" 252 MY_CONF="--enable-so=static"
231 253
232 if use ldap ; then 254 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}" 255 MY_CONF+=" --enable-authnz_ldap=${mod_type} --enable-ldap=${mod_type}"
235 MY_MODS="${MY_MODS} ldap authnz_ldap" 256 MY_MODS+=" ldap authnz_ldap"
236 else 257 else
237 MY_CONF="${MY_CONF} --disable-authnz_ldap --disable-ldap" 258 MY_CONF+=" --disable-authnz_ldap --disable-ldap"
238 fi 259 fi
239 260
240 if use ssl ; then 261 if use ssl ; then
241 MY_CONF="${MY_CONF} --with-ssl=/usr --enable-ssl=${mod_type}" 262 MY_CONF+=" --with-ssl=/usr --enable-ssl=${mod_type}"
242 MY_MODS="${MY_MODS} ssl" 263 MY_MODS+=" ssl"
243 else 264 else
244 MY_CONF="${MY_CONF} --without-ssl --disable-ssl" 265 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 266 fi
254 267
255 if use suexec ; then 268 if use suexec ; then
256 elog "You can manipulate several configure options of suexec" 269 elog "You can manipulate several configure options of suexec"
257 elog "through the following environment variables:" 270 elog "through the following environment variables:"
264 elog " SUEXEC_MINGID: Minimum GID, which is allowed to run scripts via suexec (default: 100)" 277 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)" 278 elog " SUEXEC_USERDIR: User subdirectories (like /home/user/html) (default: public_html)"
266 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)" 279 elog " SUEXEC_UMASK: Umask for the suexec process (default: 077)"
267 elog 280 elog
268 281
269 MY_CONF="${MY_CONF} --with-suexec-safepath=${SUEXEC_SAFEPATH:-/usr/local/bin:/usr/bin:/bin}" 282 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}" 283 MY_CONF+=" --with-suexec-logfile=${SUEXEC_LOGFILE:-/var/log/apache2/suexec_log}"
271 MY_CONF="${MY_CONF} --with-suexec-bin=/usr/sbin/suexec" 284 MY_CONF+=" --with-suexec-bin=/usr/sbin/suexec"
272 MY_CONF="${MY_CONF} --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}" 285 MY_CONF+=" --with-suexec-userdir=${SUEXEC_USERDIR:-public_html}"
273 MY_CONF="${MY_CONF} --with-suexec-caller=${SUEXEC_CALLER:-apache}" 286 MY_CONF+=" --with-suexec-caller=${SUEXEC_CALLER:-apache}"
274 MY_CONF="${MY_CONF} --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}" 287 MY_CONF+=" --with-suexec-docroot=${SUEXEC_DOCROOT:-/var/www}"
275 MY_CONF="${MY_CONF} --with-suexec-uidmin=${SUEXEC_MINUID:-1000}" 288 MY_CONF+=" --with-suexec-uidmin=${SUEXEC_MINUID:-1000}"
276 MY_CONF="${MY_CONF} --with-suexec-gidmin=${SUEXEC_MINGID:-100}" 289 MY_CONF+=" --with-suexec-gidmin=${SUEXEC_MINGID:-100}"
277 MY_CONF="${MY_CONF} --with-suexec-umask=${SUEXEC_UMASK:-077}" 290 MY_CONF+=" --with-suexec-umask=${SUEXEC_UMASK:-077}"
278 MY_CONF="${MY_CONF} --enable-suexec=${mod_type}" 291 MY_CONF+=" --enable-suexec=${mod_type}"
279 MY_MODS="${MY_MODS} suexec" 292 MY_MODS+=" suexec"
280 else 293 else
281 MY_CONF="${MY_CONF} --disable-suexec" 294 MY_CONF+=" --disable-suexec"
282 fi 295 fi
283 296
284 for x in ${IUSE_MODULES} ; do 297 for x in ${IUSE_MODULES} ; do
285 if use apache2_modules_${x} ; then 298 if use apache2_modules_${x} ; then
286 MY_CONF="${MY_CONF} --enable-${x}=${mod_type}" 299 MY_CONF+=" --enable-${x}=${mod_type}"
287 MY_MODS="${MY_MODS} ${x}" 300 MY_MODS+=" ${x}"
288 else 301 else
289 MY_CONF="${MY_CONF} --disable-${x}" 302 MY_CONF+=" --disable-${x}"
290 fi 303 fi
291 done 304 done
292 305
293 # sort and uniquify MY_MODS 306 # sort and uniquify MY_MODS
294 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u) 307 MY_MODS=$(echo ${MY_MODS} | tr ' ' '\n' | sort -u)
376 389
377 setup_mpm 390 setup_mpm
378 setup_modules 391 setup_modules
379 392
380 if use debug; then 393 if use debug; then
381 MY_CONF="${MY_CONF} --enable-maintainer-mode --enable-exception-hook" 394 MY_CONF+=" --enable-maintainer-mode --enable-exception-hook"
382 fi 395 fi
383 396
384 elog "Please note that you need SysV IPC support in your kernel." 397 elog "Please note that you need SysV IPC support in your kernel."
385 elog "Make sure CONFIG_SYSVIPC=y is set." 398 elog "Make sure CONFIG_SYSVIPC=y is set."
386 elog 399 elog
390 elog " accf_http_load=\"YES\"" 403 elog " accf_http_load=\"YES\""
391 elog 404 elog
392 fi 405 fi
393} 406}
394 407
395# @FUNCTION: apache-2_src_unpack 408# @FUNCTION: apache-2_src_prepare
396# @DESCRIPTION: 409# @DESCRIPTION:
397# This function applies patches, configures a custom file-system layout and 410# This function applies patches, configures a custom file-system layout and
398# rebuilds the configure scripts. 411# rebuilds the configure scripts.
399apache-2_src_unpack() { 412apache-2_src_prepare() {
400 unpack ${A}
401 cd "${S}"
402
403 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good 413 # 03_all_gentoo-apache-tools.patch injects -Wl,-z,now, which is not a good
404 # idea for everyone 414 # idea for everyone
405 case ${CHOST} in 415 case ${CHOST} in
406 *-linux-gnu|*-solaris*|*-freebsd*) 416 *-linux-gnu|*-solaris*|*-freebsd*)
407 # do nothing, these use GNU binutils 417 # do nothing, these use GNU binutils
434 mv docs/man/{httpd,apache2}.8 444 mv docs/man/{httpd,apache2}.8
435 sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in 445 sed -i -e 's/httpd\.8/apache2.8/g' Makefile.in
436 446
437 # patched-in MPMs need the build environment rebuilt 447 # patched-in MPMs need the build environment rebuilt
438 sed -i -e '/sinclude/d' configure.in 448 sed -i -e '/sinclude/d' configure.in
439 AT_GNUCONF_UPDATE=yes AT_M4DIR=build eautoreconf 449 AT_M4DIR=build eautoreconf
440}
441 450
451 # This package really should upgrade to using pcre's .pc file.
452 cat <<-\EOF >"${T}"/pcre-config
453 #!/bin/sh
454 [ "${flag}" = "--version" ] && set -- --modversion
455 exec ${PKG_CONFIG} libpcre "$@"
456 EOF
457 chmod a+x "${T}"/pcre-config
458}
459
442# @FUNCTION: apache-2_src_compile 460# @FUNCTION: apache-2_src_configure
443# @DESCRIPTION: 461# @DESCRIPTION:
444# This function adds compiler flags and runs econf and emake based on MY_MPM and 462# This function adds compiler flags and runs econf and emake based on MY_MPM and
445# MY_CONF 463# MY_CONF
446apache-2_src_compile() { 464apache-2_src_configure() {
465 tc-export PKG_CONFIG
466
467 # Sanity check in case people have bad mounts/TPE settings. #500928
468 if ! "${T}"/pcre-config --help >/dev/null ; then
469 eerror "Could not execute ${T}/pcre-config; do you have bad mount"
470 eerror "permissions in ${T} or have TPE turned on in your kernel?"
471 die "check your runtime settings #500928"
472 fi
473
447 # Instead of filtering --as-needed (bug #128505), append --no-as-needed 474 # Instead of filtering --as-needed (bug #128505), append --no-as-needed
448 # Thanks to Harald van Dijk 475 # 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 476 append-ldflags $(no-as-needed)
453 ;;
454 esac
455 477
456 # peruser MPM debugging with -X is nearly impossible 478 # peruser MPM debugging with -X is nearly impossible
457 if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then 479 if has peruser ${IUSE_MPMS} && use apache2_mpms_peruser ; then
458 use debug && append-flags -DMPM_PERUSER_DEBUG 480 use debug && append-flags -DMPM_PERUSER_DEBUG
459 fi 481 fi
460 482
461 # econf overwrites the stuff from config.layout, so we have to put them into 483 # econf overwrites the stuff from config.layout, so we have to put them into
462 # our myconf line too 484 # our myconf line too
485 ac_cv_path_PKGCONFIG=${PKG_CONFIG} \
463 econf \ 486 econf \
464 --includedir=/usr/include/apache2 \ 487 --includedir=/usr/include/apache2 \
465 --libexecdir=/usr/$(get_libdir)/apache2/modules \ 488 --libexecdir=/usr/$(get_libdir)/apache2/modules \
466 --datadir=/var/www/localhost \ 489 --datadir=/var/www/localhost \
467 --sysconfdir=/etc/apache2 \ 490 --sysconfdir=/etc/apache2 \
468 --localstatedir=/var \ 491 --localstatedir=/var \
469 --with-mpm=${MY_MPM} \ 492 --with-mpm=${MY_MPM} \
470 --with-apr=/usr \ 493 --with-apr="${SYSROOT}"/usr \
471 --with-apr-util=/usr \ 494 --with-apr-util="${SYSROOT}"/usr \
472 --with-pcre=/usr \ 495 --with-pcre="${T}"/pcre-config \
473 --with-z=/usr \ 496 --with-z=/usr \
474 --with-port=80 \ 497 --with-port=80 \
475 --with-program-name=apache2 \ 498 --with-program-name=apache2 \
476 --enable-layout=Gentoo \ 499 --enable-layout=Gentoo \
477 ${MY_CONF} || die "econf failed!" 500 ${MY_CONF} || die "econf failed!"
478 501
479 sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h 502 sed -i -e 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h
480
481 emake || die "emake failed"
482} 503}
483 504
484# @FUNCTION: apache-2_src_install 505# @FUNCTION: apache-2_src_install
485# @DESCRIPTION: 506# @DESCRIPTION:
486# This function runs `emake install' and generates, installs and adapts the gentoo 507# This function runs `emake install' and generates, installs and adapts the gentoo
487# specific configuration files found in the tarball 508# specific configuration files found in the tarball
488apache-2_src_install() { 509apache-2_src_install() {
489 make DESTDIR="${D}" install || die "make install failed" 510 emake DESTDIR="${D}" MKINSTALLDIRS="mkdir -p" install || die "make install failed"
490 511
491 # install our configuration files 512 # install our configuration files
492 keepdir /etc/apache2/vhosts.d 513 keepdir /etc/apache2/vhosts.d
493 keepdir /etc/apache2/modules.d 514 keepdir /etc/apache2/modules.d
494 515
495 generate_load_module 516 generate_load_module
496 insinto /etc/apache2 517 insinto /etc/apache2
497 doins -r "${GENTOO_PATCHDIR}"/conf/* 518 doins -r "${GENTOO_PATCHDIR}"/conf/*
498 doins docs/conf/magic 519 use apache2_modules_mime_magic && doins docs/conf/magic
499 520
500 insinto /etc/logrotate.d 521 insinto /etc/logrotate.d
501 newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2 522 newins "${GENTOO_PATCHDIR}"/scripts/apache2-logrotate apache2
502 523
503 # generate a sane default APACHE2_OPTS 524 # generate a sane default APACHE2_OPTS
504 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE" 525 APACHE2_OPTS="-D DEFAULT_VHOST -D INFO"
505 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL" 526 use doc && APACHE2_OPTS="${APACHE2_OPTS} -D MANUAL"
506 use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST" 527 use ssl && APACHE2_OPTS="${APACHE2_OPTS} -D SSL -D SSL_DEFAULT_VHOST"
507 use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC" 528 use suexec && APACHE2_OPTS="${APACHE2_OPTS} -D SUEXEC"
529 if has negotiation ${APACHE2_MODULES} && use apache2_modules_negotiation; then
530 APACHE2_OPTS="${APACHE2_OPTS} -D LANGUAGE"
531 fi
508 532
509 sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \ 533 sed -i -e "s:APACHE2_OPTS=\".*\":APACHE2_OPTS=\"${APACHE2_OPTS}\":" \
510 "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed" 534 "${GENTOO_PATCHDIR}"/init/apache2.confd || die "sed failed"
511 535
512 newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2 536 newconfd "${GENTOO_PATCHDIR}"/init/apache2.confd apache2
519 else 543 else
520 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl 544 dosym /etc/init.d/apache2 /usr/sbin/apache2ctl
521 fi 545 fi
522 546
523 # provide legacy symlink for apxs, bug 177697 547 # provide legacy symlink for apxs, bug 177697
524 dosym /usr/sbin/apxs /usr/sbin/apxs2 548 dosym apxs /usr/sbin/apxs2
525
526 # install some thirdparty scripts
527 exeinto /usr/sbin
528 use ssl && doexe "${GENTOO_PATCHDIR}"/scripts/gentestcrt.sh
529 549
530 # install some documentation 550 # install some documentation
531 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING 551 dodoc ABOUT_APACHE CHANGES LAYOUT README README.platforms VERSIONING
532 dodoc "${GENTOO_PATCHDIR}"/docs/* 552 dodoc "${GENTOO_PATCHDIR}"/docs/*
533 553
534 # drop in a convenient link to the manual 554 # drop in a convenient link to the manual
535 if use doc ; then 555 if use doc ; then
536 sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf" 556 sed -i -e "s:VERSION:${PVR}:" "${D}/etc/apache2/modules.d/00_apache_manual.conf"
557 docompress -x /usr/share/doc/${PF}/manual # 503640
537 else 558 else
538 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf" 559 rm -f "${D}/etc/apache2/modules.d/00_apache_manual.conf"
539 rm -Rf "${D}/usr/share/doc/${PF}/manual" 560 rm -Rf "${D}/usr/share/doc/${PF}/manual"
540 fi 561 fi
541 562
542 # the default webroot gets stored in /usr/share/${PF}/webroot 563 # the default icons and error pages get stored in
543 ebegin "Installing default webroot to /usr/share/${PF}/webroot" 564 # /usr/share/apache2/{error,icons}
544 dodir /usr/share/${PF} 565 dodir /usr/share/apache2
545 mv -f "${D}/var/www/localhost" "${D}/usr/share/${PF}/webroot" 566 mv -f "${D}/var/www/localhost/error" "${D}/usr/share/apache2/error"
567 mv -f "${D}/var/www/localhost/icons" "${D}/usr/share/apache2/icons"
568 rm -rf "${D}/var/www/localhost/"
546 eend $? 569 eend $?
547 570
548 # set some sane permissions for suexec 571 # set some sane permissions for suexec
549 if use suexec ; then 572 if use suexec ; then
550 fowners 0:apache /usr/sbin/suexec 573 fowners 0:${SUEXEC_CALLER:-apache} /usr/sbin/suexec
551 fperms 4710 /usr/sbin/suexec 574 fperms 4710 /usr/sbin/suexec
552 # provide legacy symlink for suexec, bug 177697 575 # provide legacy symlink for suexec, bug 177697
553 dosym /usr/sbin/suexec /usr/sbin/suexec2 576 dosym /usr/sbin/suexec /usr/sbin/suexec2
554 fi 577 fi
555 578
556 # empty dirs 579 # empty dirs
557 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do 580 for i in /var/lib/dav /var/log/apache2 /var/cache/apache2 ; do
558 keepdir ${i} 581 keepdir ${i}
559 fowners apache:apache ${i} 582 fowners apache:apache ${i}
560 fperms 0755 ${i} 583 fperms 0750 ${i}
561 done 584 done
562
563 # we need /etc/apache2/ssl if USE=ssl
564 use ssl && keepdir /etc/apache2/ssl
565} 585}
566 586
567# @FUNCTION: apache-2_pkg_postinst 587# @FUNCTION: apache-2_pkg_postinst
568# @DESCRIPTION: 588# @DESCRIPTION:
569# This function creates test certificates if SSL is enabled and installs the 589# 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 590# default index.html 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 591# 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. 592# don't want them to be managed/removed by portage when apache is upgraded.
573apache-2_pkg_postinst() { 593apache-2_pkg_postinst() {
574 einfo
575
576 if use ssl && [[ ! -e "${ROOT}/etc/apache2/ssl/server.crt" ]] ; then 594 if use ssl && [[ ! -e "${ROOT}/etc/ssl/apache2/server.pem" ]]; then
577 cd "${ROOT}"/etc/apache2/ssl 595 SSL_ORGANIZATION="${SSL_ORGANIZATION:-Apache HTTP Server}"
578 einfo "Generating self-signed test certificate in ${ROOT}etc/apache2/ssl ..." 596 install_cert /etc/ssl/apache2/server
579 yes "" 2>/dev/null | \ 597 ewarn
580 "${ROOT}"/usr/sbin/gentestcrt.sh >/dev/null 2>&1 || \ 598 ewarn "The location of SSL certificates has changed. If you are"
581 die "gentestcrt.sh failed" 599 ewarn "upgrading from ${CATEGORY}/${PN}-2.2.13 or earlier (or remerged"
582 einfo 600 ewarn "*any* apache version), you might want to move your old"
601 ewarn "certificates from /etc/apache2/ssl/ to /etc/ssl/apache2/ and"
602 ewarn "update your config files."
603 ewarn
583 fi 604 fi
584 605
585 if [[ -e "${ROOT}/var/www/localhost" ]] ; then 606 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 607 mkdir -p "${ROOT}/var/www/localhost/htdocs"
596 cp -R "${ROOT}"/usr/share/${PF}/webroot/* "${ROOT}"/var/www/localhost/ 608 echo "<html><body><h1>It works!</h1></body></html>" > "${ROOT}/var/www/localhost/htdocs/index.html"
597 einfo
598 fi 609 fi
599}
600 610
601# @FUNCTION: apache-2_pkg_config 611 echo
602# @DESCRIPTION: 612 elog "Attention: cgi and cgid modules are now handled via APACHE2_MODULES flags"
603# This function installs -- and overwrites -- the default webroot to 613 elog "in make.conf. Make sure to enable those in order to compile them."
604# /var/www/localhost 614 elog "In general, you should use 'cgid' with threaded MPMs and 'cgi' otherwise."
605apache-2_pkg_config() { 615 echo
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 616
617}
618
611EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postinst pkg_config 619EXPORT_FUNCTIONS pkg_setup src_prepare src_configure src_install pkg_postinst

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20