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

Diff of /eclass/webapp.eclass

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

Revision 1.18 Revision 1.21
1# Copyright 1999-2004 Gentoo Technologies, Inc. 1# Copyright 1999-2004 Gentoo Technologies, Inc.
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.18 2004/05/17 22:44:35 stuart Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.21 2004/05/25 10:22:02 stuart 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
21 21
22ECLASS=webapp 22ECLASS=webapp
23INHERITED="$INHERITED $ECLASS" 23INHERITED="$INHERITED $ECLASS"
24SLOT="${PVR}" 24SLOT="${PVR}"
25IUSE="$IUSE vhosts" 25IUSE="$IUSE vhosts"
26DEPEND="$DEPEND >=net-www/webapp-config-1.9 app-portage/gentoolkit" 26DEPEND="$DEPEND >=net-www/webapp-config-1.7 app-portage/gentoolkit"
27 27
28EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm 28EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm
29 29
30INSTALL_DIR="/$PN" 30INSTALL_DIR="/$PN"
31IS_UPGRADE=0 31IS_UPGRADE=0
32IS_REPLACE=0 32IS_REPLACE=0
33
34INSTALL_CHECK_FILE="installed_by_webapp_eclass"
35
36ETC_CONFIG="/etc/vhosts/webapp-config"
33 37
34# ------------------------------------------------------------------------ 38# ------------------------------------------------------------------------
35# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY 39# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
36# 40#
37# Check whether a specified file exists within the image/ directory 41# Check whether a specified file exists within the image/ directory
299 303
300 keepdir ${MY_PERSISTDIR} 304 keepdir ${MY_PERSISTDIR}
301 fowners root:root ${MY_PERSISTDIR} 305 fowners root:root ${MY_PERSISTDIR}
302 fperms 755 ${MY_PERSISTDIR} 306 fperms 755 ${MY_PERSISTDIR}
303 307
304 HAS_webapp_src_install=1 308 # to test whether or not the ebuild has correctly called this function
309 # we add an empty file to the filesystem
310 #
311 # we used to just set a variable in the shell script, but we can
312 # no longer rely on Portage calling both webapp_src_install() and
313 # webapp_pkg_postinst() within the same shell process
314
315 touch ${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}
305} 316}
306 317
307# ------------------------------------------------------------------------ 318# ------------------------------------------------------------------------
308# EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER 319# EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER
309# everything else has run 320# everything else has run
321 fi 332 fi
322 333
323 # pull in the shared configuration file 334 # pull in the shared configuration file
324 335
325 G_HOSTNAME="localhost" 336 G_HOSTNAME="localhost"
326 . /etc/vhosts/webapp-config || die "Unable to open /etc/vhosts/webapp-config file" 337 . ${ETC_CONFIG} || die "Unable to open /etc/vhosts/webapp-config file"
327 338
328 # are we installing a webapp-config solution over the top of a 339 # are we installing a webapp-config solution over the top of a
329 # non-webapp-config solution? 340 # non-webapp-config solution?
330 341
331 if ! use vhosts ; then 342 if ! use vhosts ; then
343 # okay, whatever is there, it isn't webapp-config-compatible 354 # okay, whatever is there, it isn't webapp-config-compatible
344 ewarn 355 ewarn
345 ewarn "Whatever is in $my_dir, it's not" 356 ewarn "Whatever is in $my_dir, it's not"
346 ewarn "compatible with webapp-config." 357 ewarn "compatible with webapp-config."
347 ewarn 358 ewarn
348 359 ewarn "This ebuild may be overwriting important files."
349 my_output="`qpkg -nc -v -f $my_dir`" 360 ewarn
350 if [ -n "$my_output" ]; then
351 eerror "Please remove $my_output and re-emerge."
352 else
353 eerror "Please remove the contents of $my_dir, and then re-emerge."
354 fi
355 die "Cannot upgrade contents of $my_dir"
356 elif [ "`echo $my_output | awk '{ print $1 }'`" != "$PN" ]; then 361 elif [ "`echo $my_output | awk '{ print $1 }'`" != "$PN" ]; then
357 eerror "$my_dir contains $my_output" 362 eerror "$my_dir contains $my_output"
358 eerror "I cannot upgrade that" 363 eerror "I cannot upgrade that"
359 die "Cannot upgrade contents of $my_dir" 364 die "Cannot upgrade contents of $my_dir"
360 else 365 else
427 dodir ${MY_SQLSCRIPTSDIR} 432 dodir ${MY_SQLSCRIPTSDIR}
428} 433}
429 434
430function webapp_pkg_postinst () 435function webapp_pkg_postinst ()
431{ 436{
437 . ${ETC_CONFIG}
438
432 # sanity checks, to catch bugs in the ebuild 439 # sanity checks, to catch bugs in the ebuild
433 440
434 if [ "$HAS_webapp_src_install+" == "+" ]; then 441 if [ ! -f ${MY_APPDIR}/${INSTALL_CHECK_FILE} ]; then
435 eerror 442 eerror
436 eerror "This ebuild did not call webapp_src_install() at the end" 443 eerror "This ebuild did not call webapp_src_install() at the end"
437 eerror "of the src_install() function" 444 eerror "of the src_install() function"
438 eerror 445 eerror
439 eerror "Please log a bug on http://bugs.gentoo.org" 446 eerror "Please log a bug on http://bugs.gentoo.org"

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20