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

Diff of /eclass/webapp.eclass

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

Revision 1.54 Revision 1.55
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.54 2008/02/22 14:27:17 hollow Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.55 2008/02/22 14:33:35 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
172 172
173 elog "(info) ${2} (lang: ${1})" 173 elog "(info) ${2} (lang: ${1})"
174 cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt" 174 cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt"
175} 175}
176 176
177# helper for webapp_serverowned()
178_webapp_serverowned() {
179 debug-print-function $FUNCNAME $*
180
181 webapp_checkfileexists "${1}" "${D}"
182 local my_file="$(webapp_strip_appdir "${1}")"
183 my_file="$(webapp_strip_cwd "${my_file}")"
184
185 elog "(server owned) ${my_file}"
186 echo "${my_file}" >> "${D}/${WA_SOLIST}"
187}
188
177# @FUNCTION: webapp_serverowned 189# @FUNCTION: webapp_serverowned
178# @USAGE: [-R] <file> [more files ...] 190# @USAGE: [-R] <file> [more files ...]
179# @DESCRIPTION: 191# @DESCRIPTION:
180# Identify a file which must be owned by the webserver's user:group settings. 192# Identify a file which must be owned by the webserver's user:group settings.
181# The ownership of the file is NOT set until the application is installed using 193# The ownership of the file is NOT set until the application is installed using
185 197
186 local a m 198 local a m
187 if [[ "${1}" == "-R" ]]; then 199 if [[ "${1}" == "-R" ]]; then
188 shift 200 shift
189 for m in "$@"; do 201 for m in "$@"; do
190 for a in $(find ${D}/${m}); do 202 find "${D}${m}" | while read a; do
191 a=${a/${D}\/\///}
192 webapp_checkfileexists "${a}" "$D"
193 local my_file="$(webapp_strip_appdir "${a}")" 203 a=$(webapp_strip_d "${a}")
194 my_file="$(webapp_strip_cwd "${my_file}")" 204 _webapp_serverowned "${a}"
195
196 elog "(server owned) ${my_file}"
197 echo "${my_file}" >> "${D}/${WA_SOLIST}"
198 done 205 done
199 done 206 done
200 else 207 else
201 for m in "$@"; do 208 for m in "$@"; do
202 webapp_checkfileexists "${m}" "$D" 209 _webapp_serverowned "${m}"
203 local my_file="$(webapp_strip_appdir "${m}")"
204 my_file="$(webapp_strip_cwd "${my_file}")"
205
206 elog "(server owned) ${my_file}"
207 echo "${my_file}" >> "${D}/${WA_SOLIST}"
208 done 210 done
209 fi 211 fi
210} 212}
211 213
212# @FUNCTION: webapp_server_configfile 214# @FUNCTION: webapp_server_configfile
339 local my_output 341 local my_output
340 my_output="$(webapp_check_installedat)" 342 my_output="$(webapp_check_installedat)"
341 343
342 if [[ $? -ne 0 ]]; then 344 if [[ $? -ne 0 ]]; then
343 # okay, whatever is there, it isn't webapp-config-compatible 345 # okay, whatever is there, it isn't webapp-config-compatible
346 echo
347 ewarn
344 ewarn "You already have something installed in ${my_dir}" 348 ewarn "You already have something installed in ${my_dir}"
345 ewarn 349 ewarn
346 ewarn "Whatever is in ${my_dir}, it's not" 350 ewarn "Whatever is in ${my_dir}, it's not"
347 ewarn "compatible with webapp-config." 351 ewarn "compatible with webapp-config."
348 ewarn 352 ewarn
349 ewarn "This ebuild may be overwriting important files." 353 ewarn "This ebuild may be overwriting important files."
350 ewarn 354 ewarn
355 echo
356 ebeep 10
351 elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then 357 elif [[ "$(echo ${my_output} | awk '{ print $1 }')" != "${PN}" ]]; then
352 eerror "${my_dir} contains ${my_output}" 358 echo
353 eerror "I cannot upgrade that" 359 eerror "You already have ${my_output} installed in ${my_dir}"
360 eerror
361 eerror "I cannot upgrade a different application"
362 eerror
363 echo
354 die "Cannot upgrade contents of ${my_dir}" 364 die "Cannot upgrade contents of ${my_dir}"
355 fi 365 fi
356} 366}
357 367
358# @FUNCTION: webapp_pkg_postinst 368# @FUNCTION: webapp_pkg_postinst
384 394
385 if ! use vhosts; then 395 if ! use vhosts; then
386 echo 396 echo
387 elog "vhosts USE flag not set - auto-installing using webapp-config" 397 elog "vhosts USE flag not set - auto-installing using webapp-config"
388 398
399 G_HOSTNAME="localhost"
400 webapp_read_config
401
402 local my_mode=-I
389 webapp_getinstalltype 403 webapp_getinstalltype
390
391 G_HOSTNAME="localhost"
392 local my_mode=-I
393 webapp_read_config
394 404
395 if [[ "${IS_REPLACE}" == "1" ]]; then 405 if [[ "${IS_REPLACE}" == "1" ]]; then
396 elog "${PN}-${PVR} is already installed - replacing" 406 elog "${PN}-${PVR} is already installed - replacing"
397 my_mode=-I 407 my_mode=-I
398 elif [[ "${IS_UPGRADE}" == "1" ]]; then 408 elif [[ "${IS_UPGRADE}" == "1" ]]; then

Legend:
Removed from v.1.54  
changed lines
  Added in v.1.55

  ViewVC Help
Powered by ViewVC 1.1.20