/[gentoo-x86]/eclass/webapp.eclass
Gentoo

Diff of /eclass/webapp.eclass

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

Revision 1.58 Revision 1.59
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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/webapp.eclass,v 1.58 2008/02/22 15:33:32 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.59 2008/02/23 23:54:40 hollow Exp $
4# 4#
5# @ECLASS: webapp.eclass 5# @ECLASS: webapp.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# web-apps@gentoo.org 7# web-apps@gentoo.org
8# @BLURB: functions for installing applications to run under a web server 8# @BLURB: functions for installing applications to run under a web server
9# @DESCRIPTION: 9# @DESCRIPTION:
10# The webapp eclass contains functions to handle web applications with 10# The webapp eclass contains functions to handle web applications with
11# webapp-config. Part of the implementation of GLEP #11 11# webapp-config. Part of the implementation of GLEP #11
12 12
13# @ECLASS-VARIABLE: WEBAPP_NO_AUTO_INSTALL
14# @DESCRIPTION:
15# An ebuild sets this to `yes' if an automatic installation and/or upgrade is
16# not possible. The ebuild should overwrite pkg_postinst() and explain the
17# reason for this BEFORE calling webapp_pkg_postinst().
18[[ "${WEBAPP_NO_AUTO_INSTALL}" == "yes" ]] || IUSE="vhosts"
19
13SLOT="${PVR}" 20SLOT="${PVR}"
14IUSE="vhosts"
15DEPEND=">=app-admin/webapp-config-1.50.15" 21DEPEND=">=app-admin/webapp-config-1.50.15"
16RDEPEND="${DEPEND}" 22RDEPEND="${DEPEND}"
17 23
18EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm 24EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
19 25
79 echo "${1/#.\///}" 85 echo "${1/#.\///}"
80} 86}
81 87
82webapp_getinstalltype() { 88webapp_getinstalltype() {
83 debug-print-function $FUNCNAME $* 89 debug-print-function $FUNCNAME $*
84 use vhosts && return 90
91 if ! has vhosts ${IUSE} || use vhosts; then
92 return
93 fi
85 94
86 local my_output 95 local my_output
87 my_output="$(webapp_check_installedat)" 96 my_output="$(webapp_check_installedat)"
88 97
89 if [[ $? -eq 0 ]]; then 98 if [[ $? -eq 0 ]]; then
342 webapp_read_config 351 webapp_read_config
343 352
344 local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}" 353 local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}"
345 354
346 # if USE=vhosts is enabled OR no application is installed we're done here 355 # if USE=vhosts is enabled OR no application is installed we're done here
347 use vhosts || [[ ! -d "${my_dir}" ]] && return 356 if ! has vhosts ${IUSE} || use vhosts || [[ ! -d "${my_dir}" ]]; then
357 return
358 fi
348 359
349 local my_output 360 local my_output
350 my_output="$(webapp_check_installedat)" 361 my_output="$(webapp_check_installedat)"
351 362
352 if [[ $? -ne 0 ]]; then 363 if [[ $? -ne 0 ]]; then
440 eerror "installation is incomplete" 451 eerror "installation is incomplete"
441 eerror 452 eerror
442 die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" 453 die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
443 fi 454 fi
444 455
456 if has vhosts ${IUSE}; then
445 if ! use vhosts; then 457 if ! use vhosts; then
446 echo 458 echo
447 elog "vhosts USE flag not set - auto-installing using webapp-config" 459 elog "vhosts USE flag not set - auto-installing using webapp-config"
448 460
449 G_HOSTNAME="localhost" 461 G_HOSTNAME="localhost"
450 webapp_read_config 462 webapp_read_config
451 463
452 local my_mode=-I 464 local my_mode=-I
453 webapp_getinstalltype 465 webapp_getinstalltype
454 466
455 if [[ "${IS_REPLACE}" == "1" ]]; then 467 if [[ "${IS_REPLACE}" == "1" ]]; then
456 elog "${PN}-${PVR} is already installed - replacing" 468 elog "${PN}-${PVR} is already installed - replacing"
457 my_mode=-I 469 my_mode=-I
458 elif [[ "${IS_UPGRADE}" == "1" ]]; then 470 elif [[ "${IS_UPGRADE}" == "1" ]]; then
459 elog "${REMOVE_PKG} is already installed - upgrading" 471 elog "${REMOVE_PKG} is already installed - upgrading"
460 my_mode=-U 472 my_mode=-U
473 else
474 elog "${PN}-${PVR} is not installed - using install mode"
475 fi
476
477 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
478 elog "Running ${my_cmd}"
479 ${my_cmd}
480
481 echo
482 local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
483 einfo "Running ${cleaner}"
484 ${cleaner}
461 else 485 else
462 elog "${PN}-${PVR} is not installed - using install mode" 486 elog
487 elog "The 'vhosts' USE flag is switched ON"
488 elog "This means that Portage will not automatically run webapp-config to"
489 elog "complete the installation."
490 elog
491 elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
492 elog
493 elog " webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
494 elog
495 elog "For more details, see the webapp-config(8) man page"
463 fi 496 fi
464
465 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
466 elog "Running ${my_cmd}"
467 ${my_cmd}
468
469 echo
470 local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
471 einfo "Running ${cleaner}"
472 ${cleaner}
473 else 497 else
474 elog 498 elog
475 elog "The 'vhosts' USE flag is switched ON" 499 elog "This ebuild does not support the 'vhosts' USE flag."
476 elog "This means that Portage will not automatically run webapp-config to" 500 elog "This means that Portage will not automatically run webapp-config to"
477 elog "complete the installation." 501 elog "complete the installation."
478 elog 502 elog
479 elog "To install ${PN}-${PVR} into a virtual host, run the following command:" 503 elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
480 elog 504 elog
495 local my_output= 519 local my_output=
496 my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})" 520 my_output="$(${WEBAPP_CONFIG} --list-installs ${PN} ${PVR})"
497 [[ $? -ne 0 ]] && return 521 [[ $? -ne 0 ]] && return
498 522
499 local x 523 local x
500 if ! use vhosts; then 524 if has vhosts ${IUSE} && ! use vhosts; then
501 echo "${my_output}" | while read x; do 525 echo "${my_output}" | while read x; do
502 if [[ -f "${x}"/.webapp ]]; then 526 if [[ -f "${x}"/.webapp ]]; then
503 . "${x}"/.webapp 527 . "${x}"/.webapp
504 if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then 528 if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then
505 ${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} 529 ${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR}

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59

  ViewVC Help
Powered by ViewVC 1.1.20