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

Diff of /eclass/webapp.eclass

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

Revision 1.1.1.1 Revision 1.41
1# Copyright 1999-2005 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.1.1.1 2005/11/30 09:59:13 chriswhite Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.41 2006/05/19 19:24:21 flameeyes 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 <stuart@gentoo.org>
11# Renat Lumpau <rl03@gentoo.org> 11# Renat Lumpau <rl03@gentoo.org>
12# Gunnar Wrobel <php@gunnarwrobel.org> 12# Gunnar Wrobel <wrobel@gentoo.org>
13# 13#
14# ------------------------------------------------------------------------ 14# ------------------------------------------------------------------------
15# 15#
16# The master copy of this eclass is held in our subversion repository. 16# The master copy of this eclass is held in our subversion repository.
17# http://svn.gnqs.org/projects/vhost-tools/browser/ 17# http://svn.gnqs.org/projects/vhost-tools/browser/
123# @param $1 - config file 123# @param $1 - config file
124# ------------------------------------------------------------------------ 124# ------------------------------------------------------------------------
125 125
126function webapp_configfile () 126function webapp_configfile ()
127{ 127{
128 local m=""
129 for m in "$@" ; do
128 webapp_checkfileexists "${1}" "${D}" 130 webapp_checkfileexists "${m}" "${D}"
129 131
130 local MY_FILE="$(webapp_strip_appdir ${1})" 132 local MY_FILE="$(webapp_strip_appdir "${m}")"
131 MY_FILE="$(webapp_strip_cwd ${MY_FILE})" 133 MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
132 134
133 einfo "(config) ${MY_FILE}" 135 einfo "(config) ${MY_FILE}"
134 echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST} 136 echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST}
137 done
135} 138}
136 139
137# ------------------------------------------------------------------------ 140# ------------------------------------------------------------------------
138# EXPORTED FUNCTION - FOR USE IN EBUILDS 141# EXPORTED FUNCTION - FOR USE IN EBUILDS
139# 142#
146function webapp_hook_script () 149function webapp_hook_script ()
147{ 150{
148 webapp_checkfileexists "${1}" 151 webapp_checkfileexists "${1}"
149 152
150 einfo "(hook) ${1}" 153 einfo "(hook) ${1}"
151 cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename ${1})" || die "Unable to install ${1} into ${D}/${MY_HOOKSCRIPTSDIR}/" 154 cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" || die "Unable to install ${1} into ${D}/${MY_HOOKSCRIPTSDIR}/"
152 chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename ${1})" 155 chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")"
153} 156}
154 157
155# ------------------------------------------------------------------------ 158# ------------------------------------------------------------------------
156# EXPORTED FUNCTION - FOR USE IN EBUILDS 159# EXPORTED FUNCTION - FOR USE IN EBUILDS
157# 160#
192# Identify a file which must be owned by the webserver's user:group 195# Identify a file which must be owned by the webserver's user:group
193# settings. 196# settings.
194# 197#
195# The ownership of the file is NOT set until the application is installed 198# The ownership of the file is NOT set until the application is installed
196# using the webapp-config tool. 199# using the webapp-config tool.
197# 200#
198# @param $1 - file to be owned by the webserver user:group combo 201# @param $1 - file to be owned by the webserver user:group combo
199# 202#
200# ------------------------------------------------------------------------ 203# ------------------------------------------------------------------------
201 204
202function webapp_serverowned () 205function webapp_serverowned ()
203{ 206{
207 local a=""
208 local m=""
209 if [ "${1}" = "-R" ]; then
210 shift
211 for m in "$@" ; do
212 for a in $(find ${D}/${m}); do
213 a=${a/${D}\/\///}
214 webapp_checkfileexists "${a}" "$D"
215 local MY_FILE="$(webapp_strip_appdir "${a}")"
216 MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
217
218 einfo "(server owned) ${MY_FILE}"
219 echo "${MY_FILE}" >> "${D}/${WA_SOLIST}"
220 done
221 done
222 else
223 for m in "$@" ; do
204 webapp_checkfileexists "${1}" "$D" 224 webapp_checkfileexists "${m}" "$D"
205 local MY_FILE="$(webapp_strip_appdir ${1})" 225 local MY_FILE="$(webapp_strip_appdir "${m}")"
206 MY_FILE="$(webapp_strip_cwd ${MY_FILE})" 226 MY_FILE="$(webapp_strip_cwd "${MY_FILE}")"
207 227
208 einfo "(server owned) ${MY_FILE}" 228 einfo "(server owned) ${MY_FILE}"
209 echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" 229 echo "${MY_FILE}" >> "${D}/${WA_SOLIST}"
230 done
231 fi
210} 232}
211 233
212# ------------------------------------------------------------------------ 234# ------------------------------------------------------------------------
213# EXPORTED FUNCTION - FOR USE IN EBUILDS 235# EXPORTED FUNCTION - FOR USE IN EBUILDS
214# 236#
230 # sort out what the name will be of the config file 252 # sort out what the name will be of the config file
231 253
232 local my_file 254 local my_file
233 255
234 if [ -z "${3}" ]; then 256 if [ -z "${3}" ]; then
235 my_file="${1}-$(basename ${2})" 257 my_file="${1}-$(basename "${2}")"
236 else 258 else
237 my_file="${1}-${3}" 259 my_file="${1}-${3}"
238 fi 260 fi
239 261
240 # warning: 262 # warning:
241 # 263 #
242 # do NOT change the naming convention used here without changing all 264 # do NOT change the naming convention used here without changing all
243 # the other scripts that also rely upon these names 265 # the other scripts that also rely upon these names
244 266
245 einfo "(${1}) config file '${my_file}'" 267 einfo "(${1}) config file '${my_file}'"
246 cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}" 268 cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"
247} 269}
248 270
249# ------------------------------------------------------------------------ 271# ------------------------------------------------------------------------
273 295
274 # warning: 296 # warning:
275 # 297 #
276 # do NOT change the naming convention used here without changing all 298 # do NOT change the naming convention used here without changing all
277 # the other scripts that also rely upon these names 299 # the other scripts that also rely upon these names
278 300
279 # are we dealing with an 'upgrade'-type script? 301 # are we dealing with an 'upgrade'-type script?
280 if [ -n "${3}" ]; then 302 if [ -n "${3}" ]; then
281 # yes we are 303 # yes we are
282 einfo "(${1}) upgrade script from ${PN}-${PVR} to ${3}" 304 einfo "(${1}) upgrade script from ${PN}-${PVR} to ${3}"
283 cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" 305 cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
303 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" 325 chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/"
304 chmod -R u-s "${D}/" 326 chmod -R u-s "${D}/"
305 chmod -R g-s "${D}/" 327 chmod -R g-s "${D}/"
306 328
307 keepdir "${MY_PERSISTDIR}" 329 keepdir "${MY_PERSISTDIR}"
308 fowners "root:root" "${MY_PERSISTDIR}" 330 fowners "root:0" "${MY_PERSISTDIR}"
309 fperms 755 "${MY_PERSISTDIR}" 331 fperms 755 "${MY_PERSISTDIR}"
310 332
311 # to test whether or not the ebuild has correctly called this function 333 # to test whether or not the ebuild has correctly called this function
312 # we add an empty file to the filesystem 334 # we add an empty file to the filesystem
313 # 335 #
454 die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org" 476 die "Ebuild did not call webapp_src_install() - report to http://bugs.gentoo.org"
455 fi 477 fi
456 478
457 # if 'vhosts' is not set in your USE flags, we install a copy of 479 # if 'vhosts' is not set in your USE flags, we install a copy of
458 # this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you 480 # this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you
459 481
460 if ! use vhosts ; then 482 if ! use vhosts ; then
461 echo 483 echo
462 einfo "vhosts USE flag not set - auto-installing using webapp-config" 484 einfo "vhosts USE flag not set - auto-installing using webapp-config"
463 485
464 webapp_getinstalltype 486 webapp_getinstalltype
474 einfo "${REMOVE_PKG} is already installed - upgrading" 496 einfo "${REMOVE_PKG} is already installed - upgrading"
475 my_mode=-U 497 my_mode=-U
476 else 498 else
477 einfo "${PN}-${PVR} is not installed - using install mode" 499 einfo "${PN}-${PVR} is not installed - using install mode"
478 fi 500 fi
479 501
480 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}" 502 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
481 einfo "Running ${my_cmd}" 503 einfo "Running ${my_cmd}"
482 ${my_cmd} 504 ${my_cmd}
483 505
484 # remove the old version 506 # remove the old version

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.41

  ViewVC Help
Powered by ViewVC 1.1.20