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

Diff of /eclass/webapp.eclass

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

Revision 1.4 Revision 1.6
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 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.4 2004/03/03 18:44:34 stuart Exp $
4# 3#
5# eclass/webapp.eclass 4# eclass/webapp.eclass
6# Eclass for installing applications to run under a web server 5# Eclass for installing applications to run under a web server
7# 6#
8# Part of the implementation of GLEP #11 7# Part of the implementation of GLEP #11
18 17
19ECLASS=webapp 18ECLASS=webapp
20INHERITED="$INHERITED $ECLASS" 19INHERITED="$INHERITED $ECLASS"
21SLOT="${PVR}" 20SLOT="${PVR}"
22IUSE="$IUSE vhosts" 21IUSE="$IUSE vhosts"
23G_HASCONFIG=1
24 22
25if [ -f /etc/conf.d/webapp-config ] ; then
26 . /etc/conf.d/webapp-config
27else
28 G_HASCONFIG=0
29fi
30 23
31EXPORT_FUNCTIONS pkg_config pkg_setup src_install 24EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install
32 25
33# ------------------------------------------------------------------------ 26# ------------------------------------------------------------------------
34# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY 27# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
35# 28#
36# Check whether a specified file exists within the image/ directory 29# Check whether a specified file exists within the image/ directory
99 webapp_checkfileexists "$1" "$D" 92 webapp_checkfileexists "$1" "$D"
100 local MY_FILE="`webapp_strip_appdir $1`" 93 local MY_FILE="`webapp_strip_appdir $1`"
101 94
102 einfo "(config) $MY_FILE" 95 einfo "(config) $MY_FILE"
103 echo "$MY_FILE" >> $WA_CONFIGLIST 96 echo "$MY_FILE" >> $WA_CONFIGLIST
97}
98
99# ------------------------------------------------------------------------
100# EXPORTED FUNCTION - FOR USE IN EBUILDS
101#
102# Install a text file containing post-installation instructions.
103#
104# @param $1 - language code (use 'en' for now)
105# @param $2 - the file to install
106# ------------------------------------------------------------------------
107
108function webapp_postinst_txt
109{
110 webapp_checkfileexists "$2"
111
112 einfo "(rtfm) $2 (lang: $1)"
113 cp "$2" "${MY_APPDIR}/postinst-$1.txt"
104} 114}
105 115
106# ------------------------------------------------------------------------ 116# ------------------------------------------------------------------------
107# EXPORTED FUNCTION - FOR USE IN EBUILDS 117# EXPORTED FUNCTION - FOR USE IN EBUILDS
108# 118#
203function webapp_src_install () 213function webapp_src_install ()
204{ 214{
205 chown -R root:root ${D}/ 215 chown -R root:root ${D}/
206 chmod -R u-s ${D}/ 216 chmod -R u-s ${D}/
207 chmod -R g-s ${D}/ 217 chmod -R g-s ${D}/
218
219 keepdir ${MY_PERSISTDIR}
220 fowners root:root ${MY_PERSISTDIR}
221 fperms 755 ${MY_PERSISTDIR}
208} 222}
209 223
210# ------------------------------------------------------------------------ 224# ------------------------------------------------------------------------
211# EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER 225# EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER
212# everything else has run 226# everything else has run
215# 229#
216# ------------------------------------------------------------------------ 230# ------------------------------------------------------------------------
217 231
218function webapp_pkg_setup () 232function webapp_pkg_setup ()
219{ 233{
220 # we do have the config file, right? 234 if [ -f /etc/vhosts/webapp-config ] ; then
221 235 . /etc/vhosts/webapp-config
222 if [ "$G_HASCONFIG" = "0" ]; then 236 else
223 die "/etc/conf.d/webapp-config missing" 237 die "Unable to find /etc/vhosts/webapp-config"
224 fi 238 fi
225 239
226 # are we emerging something that is already installed? 240 # are we emerging something that is already installed?
227 241
228 if [ -d "${MY_APPROOT}/${MY_APPSUFFIX}" ]; then 242 if [ -d "${MY_APPROOT}/${MY_APPSUFFIX}" ]; then
239 mkdir -p ${MY_ICONSDIR} 253 mkdir -p ${MY_ICONSDIR}
240 mkdir -p ${MY_ERRORSDIR} 254 mkdir -p ${MY_ERRORSDIR}
241 mkdir -p ${MY_SQLSCRIPTSDIR} 255 mkdir -p ${MY_SQLSCRIPTSDIR}
242} 256}
243 257
244function webapp_pkg_config () 258function webapp_pkg_postinst ()
245{ 259{
246 use vhosts || webapp-config -u root -d /var/www/localhost/htdocs/${PN}/ ${PN} 260 G_HOSTNAME="${VHOST_HOSTNAME}"
261 use vhosts || /usr/sbin/webapp-config -I -u root -d "${VHOST_ROOT}/htdocs/${PN}/" ${PN} ${PVR}
247} 262}

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20