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

Diff of /eclass/webapp.eclass

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

Revision 1.10 Revision 1.11
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.10 2004/04/28 22:18:27 stuart Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.11 2004/04/29 10:18:14 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
69# 69#
70# ------------------------------------------------------------------------ 70# ------------------------------------------------------------------------
71 71
72function webapp_strip_appdir () 72function webapp_strip_appdir ()
73{ 73{
74 echo "$1" | sed -e "s|${D}${MY_APPDIR}/||g;" 74 echo "$1" | sed -e "s|${MY_APPDIR}/||g;"
75} 75}
76 76
77function webapp_strip_d () 77function webapp_strip_d ()
78{ 78{
79 echo "$1" | sed -e "s|${D}||g;" 79 echo "$1" | sed -e "s|${D}||g;"
93# ------------------------------------------------------------------------ 93# ------------------------------------------------------------------------
94 94
95function webapp_configfile () 95function webapp_configfile ()
96{ 96{
97 webapp_checkfileexists "$1" "$D" 97 webapp_checkfileexists "$1" "$D"
98 echo $1
98 local MY_FILE="`webapp_strip_appdir $1`" 99 local MY_FILE="`webapp_strip_appdir $1`"
100 echo $MY_FILE
99 101
100 einfo "(config) $MY_FILE" 102 einfo "(config) $MY_FILE"
101 echo "$MY_FILE" >> ${D}${WA_CONFIGLIST} 103 echo "$MY_FILE" >> ${D}${WA_CONFIGLIST}
102} 104}
103 105
264function webapp_pkg_postinst () 266function webapp_pkg_postinst ()
265{ 267{
266 # if 'vhosts' is not set in your USE flags, we install a copy of 268 # if 'vhosts' is not set in your USE flags, we install a copy of
267 # this application in /var/www/localhost/htdocs/${PN}/ for you 269 # this application in /var/www/localhost/htdocs/${PN}/ for you
268 270
271
269 if ! use vhosts ; then 272 if ! use vhosts ; then
273 einfo "vhosts USE flag not set - auto-installing using webapp-config"
274
270 G_HOSTNAME="localhost" 275 G_HOSTNAME="localhost"
271 . /etc/vhosts/webapp-config 276 . /etc/vhosts/webapp-config
272 277
273 local my_mode=-I 278 local my_mode=-I
274 local my_dir="${VHOST_ROOT}/htdocs/${PN}" 279 local my_dir="${VHOST_ROOT}/htdocs/${PN}"
275 280
276 # are we installing afresh - or are we upgrading? 281 # are we installing afresh - or are we upgrading?
277 # find out by looking to see what (if anything) is installed 282 # find out by looking to see what (if anything) is installed
278 # in there already 283 # in there already
279 284
285 my_cmd="/usr/sbin/webapp-config --show-installed -d $my_dir 2> /dev/null"
286 einfo "$my_cmd"
287
280 local my_output="`/usr/sbin/webapp-config --show-installed -d $my_dir 2> /dev/null`" 288 my_output="`/usr/sbin/webapp-config --show-installed -d $my_dir 2> /dev/null`"
289
290 # we can't use the exit status from webapp-config
291
281 if [ "$?" = 0 ]; then 292 if [ "$?" = "0" ]; then
282 293
283 # something is in there - but the question has to be ... what? 294 # something is in there - but the question has to be ... what?
284 295
296 ewarn "$my_output already installed"
297
285 if [ "`echo $my_output | awk '{ print $1 }'`" = "${PN}" ]; then 298 if [ "`echo $my_output | awk '{ print $1 }'`" = "${PN}" ]; then
299 einfo "$my_output is a copy of ${PN}"
300 if [ "`echo $my_output | awk '{ print $2 }'`" = "${PVR}" ]; then
301 # this version is already installed
302 # we need to remove it first
303
304 /usr/sbin/webapp-config -C -d $my_dir
305 else
286 # we have an older version of whatever it is our ebuild is 306 # we have an older version of whatever it is our ebuild is
287 # trying to install ;-) 307 # trying to install ;-)
288 # 308 #
289 # this is the situation we can deal with 309 # this is the situation we can deal with
290 310
311 einfo "selecting upgrade mode"
291 my_mode=-U 312 my_mode=-U
313 fi
292 else 314 else
293 # this should never happen - but just in case ... 315 # this should never happen - but just in case ...
294 # 316 #
295 # whatever is in that directory, it isn't the application 317 # whatever is in that directory, it isn't the application
296 # that we are currently trying to install 318 # that we are currently trying to install
298 # rather than overwrite the contents, we bail with an error 320 # rather than overwrite the contents, we bail with an error
299 # instead 321 # instead
300 322
301 die "$my_output is already installed in $my_dir" 323 die "$my_output is already installed in $my_dir"
302 fi 324 fi
325 else
326 einfo "${PN}-${PVR} is not installed - using install mode"
303 fi 327 fi
304 328
305 /usr/sbin/webapp-config $my_mode -u root -d "$my_dir" ${PN} ${PVR} 329 my_cmd="/usr/sbin/webapp-config $my_mode -u root -d $my_dir ${PN} ${PVR}"
330 einfo "Running $my_cmd"
331 $my_cmd
306 fi 332 fi
333
334 return 0
307} 335}

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20