| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 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.33 2005/07/06 20:23:20 agriffis Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.34 2005/07/11 15:08:06 swegener Exp $ |
| 4 | # |
4 | # |
| 5 | # eclass/webapp.eclass |
5 | # eclass/webapp.eclass |
| 6 | # Eclass for installing applications to run under a web server |
6 | # Eclass for installing applications to run under a web server |
| 7 | # |
7 | # |
| 8 | # Part of the implementation of GLEP #11 |
8 | # Part of the implementation of GLEP #11 |
| … | |
… | |
| 199 | # Identify a file which must be owned by the webserver's user:group |
199 | # Identify a file which must be owned by the webserver's user:group |
| 200 | # settings. |
200 | # settings. |
| 201 | # |
201 | # |
| 202 | # The ownership of the file is NOT set until the application is installed |
202 | # The ownership of the file is NOT set until the application is installed |
| 203 | # using the webapp-config tool. |
203 | # using the webapp-config tool. |
| 204 | # |
204 | # |
| 205 | # @param $1 - file to be owned by the webserver user:group combo |
205 | # @param $1 - file to be owned by the webserver user:group combo |
| 206 | # |
206 | # |
| 207 | # ------------------------------------------------------------------------ |
207 | # ------------------------------------------------------------------------ |
| 208 | |
208 | |
| 209 | function webapp_serverowned () |
209 | function webapp_serverowned () |
| 210 | { |
210 | { |
| 211 | webapp_checkfileexists "$1" "$D" |
211 | webapp_checkfileexists "$1" "$D" |
| 212 | local MY_FILE="`webapp_strip_appdir \"$1\"`" |
212 | local MY_FILE="`webapp_strip_appdir \"$1\"`" |
| 213 | MY_FILE="`webapp_strip_cwd \"$MY_FILE\"`" |
213 | MY_FILE="`webapp_strip_cwd \"$MY_FILE\"`" |
| 214 | |
214 | |
| 215 | einfo "(server owned) $MY_FILE" |
215 | einfo "(server owned) $MY_FILE" |
| 216 | echo "$MY_FILE" >> "${D}${WA_SOLIST}" |
216 | echo "$MY_FILE" >> "${D}${WA_SOLIST}" |
| 217 | } |
217 | } |
| 218 | |
218 | |
| 219 | # ------------------------------------------------------------------------ |
219 | # ------------------------------------------------------------------------ |
| … | |
… | |
| 246 | |
246 | |
| 247 | # warning: |
247 | # warning: |
| 248 | # |
248 | # |
| 249 | # do NOT change the naming convention used here without changing all |
249 | # do NOT change the naming convention used here without changing all |
| 250 | # the other scripts that also rely upon these names |
250 | # the other scripts that also rely upon these names |
| 251 | |
251 | |
| 252 | einfo "($1) config file '$my_file'" |
252 | einfo "($1) config file '$my_file'" |
| 253 | cp "$2" "${D}${MY_SERVERCONFIGDIR}/${my_file}" |
253 | cp "$2" "${D}${MY_SERVERCONFIGDIR}/${my_file}" |
| 254 | } |
254 | } |
| 255 | |
255 | |
| 256 | # ------------------------------------------------------------------------ |
256 | # ------------------------------------------------------------------------ |
| … | |
… | |
| 280 | |
280 | |
| 281 | # warning: |
281 | # warning: |
| 282 | # |
282 | # |
| 283 | # do NOT change the naming convention used here without changing all |
283 | # do NOT change the naming convention used here without changing all |
| 284 | # the other scripts that also rely upon these names |
284 | # the other scripts that also rely upon these names |
| 285 | |
285 | |
| 286 | # are we dealing with an 'upgrade'-type script? |
286 | # are we dealing with an 'upgrade'-type script? |
| 287 | if [ -n "$3" ]; then |
287 | if [ -n "$3" ]; then |
| 288 | # yes we are |
288 | # yes we are |
| 289 | einfo "($1) upgrade script from ${PN}-${PVR} to $3" |
289 | einfo "($1) upgrade script from ${PN}-${PVR} to $3" |
| 290 | cp "$2" "${D}${MY_SQLSCRIPTSDIR}/$1/${3}_to_${PVR}.sql" |
290 | cp "$2" "${D}${MY_SQLSCRIPTSDIR}/$1/${3}_to_${PVR}.sql" |
| … | |
… | |
| 345 | # pull in the shared configuration file |
345 | # pull in the shared configuration file |
| 346 | |
346 | |
| 347 | G_HOSTNAME="localhost" |
347 | G_HOSTNAME="localhost" |
| 348 | . "${ETC_CONFIG}" || die "Unable to open file ${ETC_CONFIG}" |
348 | . "${ETC_CONFIG}" || die "Unable to open file ${ETC_CONFIG}" |
| 349 | |
349 | |
| 350 | # are we installing a webapp-config solution over the top of a |
350 | # are we installing a webapp-config solution over the top of a |
| 351 | # non-webapp-config solution? |
351 | # non-webapp-config solution? |
| 352 | |
352 | |
| 353 | if ! use vhosts ; then |
353 | if ! use vhosts ; then |
| 354 | local my_dir="$VHOST_ROOT/$MY_HTDOCSBASE/$PN" |
354 | local my_dir="$VHOST_ROOT/$MY_HTDOCSBASE/$PN" |
| 355 | local my_output |
355 | local my_output |
| … | |
… | |
| 464 | die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" |
464 | die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" |
| 465 | fi |
465 | fi |
| 466 | |
466 | |
| 467 | # if 'vhosts' is not set in your USE flags, we install a copy of |
467 | # if 'vhosts' is not set in your USE flags, we install a copy of |
| 468 | # this application in /var/www/localhost/htdocs/${PN}/ for you |
468 | # this application in /var/www/localhost/htdocs/${PN}/ for you |
| 469 | |
469 | |
| 470 | if ! use vhosts ; then |
470 | if ! use vhosts ; then |
| 471 | echo |
471 | echo |
| 472 | einfo "vhosts USE flag not set - auto-installing using webapp-config" |
472 | einfo "vhosts USE flag not set - auto-installing using webapp-config" |
| 473 | |
473 | |
| 474 | webapp_getinstalltype |
474 | webapp_getinstalltype |
| … | |
… | |
| 485 | einfo "$REMOVE_PKG is already installed - upgrading" |
485 | einfo "$REMOVE_PKG is already installed - upgrading" |
| 486 | my_mode=-U |
486 | my_mode=-U |
| 487 | else |
487 | else |
| 488 | einfo "${PN}-${PVR} is not installed - using install mode" |
488 | einfo "${PN}-${PVR} is not installed - using install mode" |
| 489 | fi |
489 | fi |
| 490 | |
490 | |
| 491 | my_cmd="/usr/sbin/webapp-config $my_mode -h localhost -u root -d $INSTALL_DIR ${PN} ${PVR}" |
491 | my_cmd="/usr/sbin/webapp-config $my_mode -h localhost -u root -d $INSTALL_DIR ${PN} ${PVR}" |
| 492 | einfo "Running $my_cmd" |
492 | einfo "Running $my_cmd" |
| 493 | $my_cmd |
493 | $my_cmd |
| 494 | |
494 | |
| 495 | # remove the old version |
495 | # remove the old version |