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

Diff of /eclass/webapp.eclass

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

Revision 1.56 Revision 1.57
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.56 2008/02/22 14:44:16 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.57 2008/02/22 14:59:07 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
20INSTALL_DIR="/${PN}" 20INSTALL_DIR="/${PN}"
21IS_UPGRADE=0 21IS_UPGRADE=0
22IS_REPLACE=0 22IS_REPLACE=0
23 23
24INSTALL_CHECK_FILE="installed_by_webapp_eclass" 24INSTALL_CHECK_FILE="installed_by_webapp_eclass"
25SETUP_CHECK_FILE="setup_by_webapp_eclass"
25 26
26ETC_CONFIG="${ROOT}etc/vhosts/webapp-config" 27ETC_CONFIG="${ROOT}etc/vhosts/webapp-config"
27WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config" 28WEBAPP_CONFIG="${ROOT}usr/sbin/webapp-config"
28WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner" 29WEBAPP_CLEANER="${ROOT}usr/sbin/webapp-cleaner"
29 30
283 284
284# ============================================================================== 285# ==============================================================================
285# EXPORTED FUNCTIONS 286# EXPORTED FUNCTIONS
286# ============================================================================== 287# ==============================================================================
287 288
288# @FUNCTION: webapp_src_install
289# @DESCRIPTION:
290# This is the default src_install(). For now, we just make sure that root owns
291# everything, and that there are no setuid files.
292#
293# You need to call this function AFTER everything else has run in your custom
294# src_install().
295webapp_src_install() {
296 debug-print-function $FUNCNAME $*
297
298 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
299 chmod -R u-s "${D}/"
300 chmod -R g-s "${D}/"
301
302 keepdir "${MY_PERSISTDIR}"
303 fowners "root:0" "${MY_PERSISTDIR}"
304 fperms 755 "${MY_PERSISTDIR}"
305
306 # to test whether or not the ebuild has correctly called this function
307 # we add an empty file to the filesystem
308 #
309 # we used to just set a variable in the shell script, but we can
310 # no longer rely on Portage calling both webapp_src_install() and
311 # webapp_pkg_postinst() within the same shell process
312
313 touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
314}
315
316# @FUNCTION: webapp_pkg_setup 289# @FUNCTION: webapp_pkg_setup
317# @DESCRIPTION: 290# @DESCRIPTION:
318# The default pkg_setup() for this eclass. This will gather required variables 291# The default pkg_setup() for this eclass. This will gather required variables
319# from webapp-config and check if there is an application installed to 292# from webapp-config and check if there is an application installed to
320# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. 293# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set.
322# You need to call this function BEFORE anything else has run in your custom 295# You need to call this function BEFORE anything else has run in your custom
323# pkg_setup(). 296# pkg_setup().
324webapp_pkg_setup() { 297webapp_pkg_setup() {
325 debug-print-function $FUNCNAME $* 298 debug-print-function $FUNCNAME $*
326 299
300 # to test whether or not the ebuild has correctly called this function
301 # we add an empty file to the filesystem
302 #
303 # we used to just set a variable in the shell script, but we can
304 # no longer rely on Portage calling both webapp_pkg_setup() and
305 # webapp_src_install() within the same shell process
306 touch "${T}/${SETUP_CHECK_FILE}"
307
327 # special case - some ebuilds *do* need to overwride the SLOT 308 # special case - some ebuilds *do* need to overwride the SLOT
328 if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then 309 if [[ "${SLOT}+" != "${PVR}+" && "${WEBAPP_MANUAL_SLOT}" != "yes" ]]; then
329 die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually" 310 die "Set WEBAPP_MANUAL_SLOT=\"yes\" if you need to SLOT manually"
330 fi 311 fi
331 312
361 eerror "I cannot upgrade a different application" 342 eerror "I cannot upgrade a different application"
362 eerror 343 eerror
363 echo 344 echo
364 die "Cannot upgrade contents of ${my_dir}" 345 die "Cannot upgrade contents of ${my_dir}"
365 fi 346 fi
347
348}
349
350# @FUNCTION: webapp_src_install
351# @DESCRIPTION:
352# This is the default src_install(). For now, we just make sure that root owns
353# everything, and that there are no setuid files.
354#
355# You need to call this function AFTER everything else has run in your custom
356# src_install().
357webapp_src_install() {
358 debug-print-function $FUNCNAME $*
359
360 # to test whether or not the ebuild has correctly called this function
361 # we add an empty file to the filesystem
362 #
363 # we used to just set a variable in the shell script, but we can
364 # no longer rely on Portage calling both webapp_src_install() and
365 # webapp_pkg_postinst() within the same shell process
366 touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}"
367
368 # sanity checks, to catch bugs in the ebuild
369 if [[ ! -f "${T}/${SETUP_CHECK_FILE}" ]]; then
370 eerror
371 eerror "This ebuild did not call webapp_pkg_setup() at the beginning"
372 eerror "of the pkg_setup() function"
373 eerror
374 eerror "Please log a bug on http://bugs.gentoo.org"
375 eerror
376 eerror "You should use emerge -C to remove this package, as the"
377 eerror "installation is incomplete"
378 eerror
379 die "Ebuild did not call webapp_pkg_setup() - report to http://bugs.gentoo.org"
380 fi
381
382 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
383 chmod -R u-s "${D}/"
384 chmod -R g-s "${D}/"
385
386 keepdir "${MY_PERSISTDIR}"
387 fowners "root:0" "${MY_PERSISTDIR}"
388 fperms 755 "${MY_PERSISTDIR}"
366} 389}
367 390
368# @FUNCTION: webapp_pkg_postinst 391# @FUNCTION: webapp_pkg_postinst
369# @DESCRIPTION: 392# @DESCRIPTION:
370# The default pkg_postinst() for this eclass. This installs the web application to 393# The default pkg_postinst() for this eclass. This installs the web application to

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57

  ViewVC Help
Powered by ViewVC 1.1.20