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

Diff of /eclass/webapp.eclass

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

Revision 1.43 Revision 1.47
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.43 2006/07/10 00:52:34 rl03 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.47 2006/12/31 19:16:31 rl03 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
9# 9#
10# Author(s) Stuart Herbert <stuart@gentoo.org> 10# Author(s) Stuart Herbert
11# Renat Lumpau <rl03@gentoo.org> 11# Renat Lumpau <rl03@gentoo.org>
12# Gunnar Wrobel <wrobel@gentoo.org> 12# Gunnar Wrobel <wrobel@gentoo.org>
13# 13#
14# ------------------------------------------------------------------------ 14# ------------------------------------------------------------------------
15# 15#
22# 22#
23# ------------------------------------------------------------------------ 23# ------------------------------------------------------------------------
24 24
25SLOT="${PVR}" 25SLOT="${PVR}"
26IUSE="vhosts" 26IUSE="vhosts"
27DEPEND="app-admin/webapp-config" 27DEPEND=">=app-admin/webapp-config-1.50.15"
28RDEPEND="${DEPEND}" 28RDEPEND="${DEPEND}"
29 29
30EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm 30EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
31 31
32INSTALL_DIR="/${PN}" 32INSTALL_DIR="/${PN}"
35 35
36INSTALL_CHECK_FILE="installed_by_webapp_eclass" 36INSTALL_CHECK_FILE="installed_by_webapp_eclass"
37 37
38ETC_CONFIG="${ROOT}/etc/vhosts/webapp-config" 38ETC_CONFIG="${ROOT}/etc/vhosts/webapp-config"
39WEBAPP_CONFIG="${ROOT}/usr/sbin/webapp-config" 39WEBAPP_CONFIG="${ROOT}/usr/sbin/webapp-config"
40WEBAPP_CLEANER="${ROOT}/usr/sbin/webapp-cleaner"
40 41
41# ------------------------------------------------------------------------ 42# ------------------------------------------------------------------------
42# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY 43# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
43# 44#
44# Load the config file /etc/vhosts/webapp-config 45# Load the config file /etc/vhosts/webapp-config
350 351
351function webapp_pkg_setup () 352function webapp_pkg_setup ()
352{ 353{
353 # add sanity checks here 354 # add sanity checks here
354 355
355 if [ "${SLOT}+" != "${PVR}+" ]; then
356 # special case - some ebuilds *do* need to overwride the SLOT 356 # special case - some ebuilds *do* need to overwride the SLOT
357 if [ "${WEBAPP_MANUAL_SLOT}" != "yes" ]; then 357 if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then
358 die "ebuild sets SLOT, overrides webapp.eclass" 358 die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually"
359 else
360 ewarn
361 ewarn "This ebuild overrides the default SLOT behaviour for webapps"
362 ewarn "If this package installs files into the htdocs dir, this is"
363 ewarn "probably a bug in the ebuild."
364 ewarn
365 fi
366 fi 359 fi
367 360
368 # pull in the shared configuration file 361 # pull in the shared configuration file
369 362
370 G_HOSTNAME="localhost" 363 G_HOSTNAME="localhost"
380 if [ -d "${my_dir}" ] ; then 373 if [ -d "${my_dir}" ] ; then
381 my_output="$(webapp_check_installedat)" 374 my_output="$(webapp_check_installedat)"
382 375
383 if [ "$?" != "0" ]; then 376 if [ "$?" != "0" ]; then
384 # okay, whatever is there, it isn't webapp-config-compatible 377 # okay, whatever is there, it isn't webapp-config-compatible
385 ewarn "You already have something installed in ${my_dir}" 378 ewarn "You already have something installed in ${my_dir}"
386 ewarn 379 ewarn
387 ewarn "Whatever is in ${my_dir}, it's not" 380 ewarn "Whatever is in ${my_dir}, it's not"
388 ewarn "compatible with webapp-config." 381 ewarn "compatible with webapp-config."
389 ewarn 382 ewarn
390 ewarn "This ebuild may be overwriting important files." 383 ewarn "This ebuild may be overwriting important files."
494 487
495 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}" 488 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
496 elog "Running ${my_cmd}" 489 elog "Running ${my_cmd}"
497 ${my_cmd} 490 ${my_cmd}
498 491
499 # remove the old version 492 # run webapp-cleaner instead of emerge
500 # 493 echo
501 # why do we do this? well ... 494 local cleaner="${WEBAPP_CLEANER} -p -C ${PN}"
502 # 495 einfo "Running ${cleaner}"
503 # normally, emerge -u installs a new version and then removes the 496 ${cleaner}
504 # old version. however, if the new version goes into a different
505 # slot to the old version, then the old version gets left behind
506 #
507 # if USE=-vhosts, then we want to remove the old version, because
508 # the user is relying on portage to do the magical thing for it
509
510 if [ "${IS_UPGRADE}" = "1" ] ; then
511 elog "Removing old version ${REMOVE_PKG}"
512
513 emerge -C "${REMOVE_PKG}"
514 fi
515 else 497 else
516 # vhosts flag is on 498 # vhosts flag is on
517 # 499 #
518 # let's tell the administrator what to do next 500 # let's tell the administrator what to do next
519 501

Legend:
Removed from v.1.43  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.20