| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2011 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.66 2011/05/19 12:05:13 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.70 2011/12/27 17:55:12 fauli 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 |
| … | |
… | |
| 57 | debug-print-function $FUNCNAME $* |
57 | debug-print-function $FUNCNAME $* |
| 58 | |
58 | |
| 59 | if has_version '>=app-admin/webapp-config-1.50'; then |
59 | if has_version '>=app-admin/webapp-config-1.50'; then |
| 60 | ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!" |
60 | ENVVAR=$(${WEBAPP_CONFIG} --query ${PN} ${PVR}) || die "Could not read settings from webapp-config!" |
| 61 | eval ${ENVVAR} |
61 | eval ${ENVVAR} |
| 62 | else |
62 | elif [[ "${WEBAPP_OPTIONAL}" != "yes" ]]; then |
|
|
63 | # ETC_CONFIG might not be available |
|
|
64 | . ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}" |
|
|
65 | elif [[ -f "${ETC_CONFIG}" ]]; then |
|
|
66 | # WEBAPP_OPTIONAL is set to yes |
|
|
67 | # and this must run only if ETC_CONFIG actually exists |
| 63 | . ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}" |
68 | . ${ETC_CONFIG} || die "Unable to read ${ETC_CONFIG}" |
| 64 | fi |
69 | fi |
| 65 | } |
70 | } |
| 66 | |
71 | |
| 67 | # Check whether a specified file exists in the given directory (`.' by default) |
72 | # Check whether a specified file exists in the given directory (`.' by default) |
| … | |
… | |
| 119 | |
124 | |
| 120 | if [[ "${my_pn}" == "${PN}" ]]; then |
125 | if [[ "${my_pn}" == "${PN}" ]]; then |
| 121 | if [[ "${my_pvr}" != "${PVR}" ]]; then |
126 | if [[ "${my_pvr}" != "${PVR}" ]]; then |
| 122 | elog "This is an upgrade" |
127 | elog "This is an upgrade" |
| 123 | IS_UPGRADE=1 |
128 | IS_UPGRADE=1 |
|
|
129 | # for binpkgs, reset status, var declared in global scope |
|
|
130 | IS_REPLACE=0 |
| 124 | else |
131 | else |
| 125 | elog "This is a re-installation" |
132 | elog "This is a re-installation" |
| 126 | IS_REPLACE=1 |
133 | IS_REPLACE=1 |
|
|
134 | # for binpkgs, reset status, var declared in global scope |
|
|
135 | IS_UPGRADE=0 |
| 127 | fi |
136 | fi |
| 128 | else |
137 | else |
| 129 | elog "${my_output} is installed there" |
138 | elog "${my_output} is installed there" |
| 130 | fi |
139 | fi |
| 131 | else |
140 | else |
|
|
141 | # for binpkgs, reset status, var declared in global scope |
|
|
142 | IS_REPLACE=0 |
|
|
143 | IS_UPGRADE=0 |
| 132 | elog "This is an installation" |
144 | elog "This is an installation" |
| 133 | fi |
145 | fi |
| 134 | } |
146 | } |
| 135 | |
147 | |
| 136 | # ============================================================================== |
148 | # ============================================================================== |
| … | |
… | |
| 492 | my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}" |
504 | my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}" |
| 493 | elog "Running ${my_cmd}" |
505 | elog "Running ${my_cmd}" |
| 494 | ${my_cmd} |
506 | ${my_cmd} |
| 495 | |
507 | |
| 496 | echo |
508 | echo |
| 497 | local cleaner="${WEBAPP_CLEANER} -p -C ${PN}" |
509 | local cleaner="${WEBAPP_CLEANER} -p -C /${PN}" |
| 498 | einfo "Running ${cleaner}" |
510 | einfo "Running ${cleaner}" |
| 499 | ${cleaner} |
511 | ${cleaner} |
| 500 | else |
512 | else |
| 501 | elog |
513 | elog |
| 502 | elog "The 'vhosts' USE flag is switched ON" |
514 | elog "The 'vhosts' USE flag is switched ON" |
| … | |
… | |
| 539 | if has vhosts ${IUSE} && ! use vhosts; then |
551 | if has vhosts ${IUSE} && ! use vhosts; then |
| 540 | echo "${my_output}" | while read x; do |
552 | echo "${my_output}" | while read x; do |
| 541 | if [[ -f "${x}"/.webapp ]]; then |
553 | if [[ -f "${x}"/.webapp ]]; then |
| 542 | . "${x}"/.webapp |
554 | . "${x}"/.webapp |
| 543 | if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then |
555 | if [[ -n "${WEB_HOSTNAME}" && -n "${WEB_INSTALLDIR}" ]]; then |
| 544 | ${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} |
556 | ${WEBAPP_CONFIG} -C -h ${WEB_HOSTNAME} -d ${WEB_INSTALLDIR} ${PN} ${PVR} |
| 545 | fi |
557 | fi |
| 546 | else |
558 | else |
| 547 | ewarn "Cannot find file ${x}/.webapp" |
559 | ewarn "Cannot find file ${x}/.webapp" |
| 548 | fi |
560 | fi |
| 549 | done |
561 | done |