| 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.39 2006/01/11 15:19:42 rl03 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 |
| … | |
… | |
| 127 | { |
127 | { |
| 128 | local m="" |
128 | local m="" |
| 129 | for m in "$@" ; do |
129 | for m in "$@" ; do |
| 130 | webapp_checkfileexists "${m}" "${D}" |
130 | webapp_checkfileexists "${m}" "${D}" |
| 131 | |
131 | |
| 132 | local MY_FILE="$(webapp_strip_appdir ${m})" |
132 | local MY_FILE="$(webapp_strip_appdir "${m}")" |
| 133 | MY_FILE="$(webapp_strip_cwd ${MY_FILE})" |
133 | MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
| 134 | |
134 | |
| 135 | einfo "(config) ${MY_FILE}" |
135 | einfo "(config) ${MY_FILE}" |
| 136 | echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST} |
136 | echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST} |
| 137 | done |
137 | done |
| 138 | } |
138 | } |
| … | |
… | |
| 149 | function webapp_hook_script () |
149 | function webapp_hook_script () |
| 150 | { |
150 | { |
| 151 | webapp_checkfileexists "${1}" |
151 | webapp_checkfileexists "${1}" |
| 152 | |
152 | |
| 153 | einfo "(hook) ${1}" |
153 | einfo "(hook) ${1}" |
| 154 | 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}/" |
| 155 | chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename ${1})" |
155 | chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" |
| 156 | } |
156 | } |
| 157 | |
157 | |
| 158 | # ------------------------------------------------------------------------ |
158 | # ------------------------------------------------------------------------ |
| 159 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
159 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
| 160 | # |
160 | # |
| … | |
… | |
| 204 | |
204 | |
| 205 | function webapp_serverowned () |
205 | function webapp_serverowned () |
| 206 | { |
206 | { |
| 207 | local a="" |
207 | local a="" |
| 208 | local m="" |
208 | local m="" |
| 209 | if [ ${1} = "-R" ]; then |
209 | if [ "${1}" = "-R" ]; then |
| 210 | shift |
210 | shift |
| 211 | for m in "$@" ; do |
211 | for m in "$@" ; do |
| 212 | for a in $(find ${D}/${m}); do |
212 | for a in $(find ${D}/${m}); do |
| 213 | a=${a/${D}\/\///} |
213 | a=${a/${D}\/\///} |
| 214 | webapp_checkfileexists "${a}" "$D" |
214 | webapp_checkfileexists "${a}" "$D" |
| 215 | local MY_FILE="$(webapp_strip_appdir ${a})" |
215 | local MY_FILE="$(webapp_strip_appdir "${a}")" |
| 216 | MY_FILE="$(webapp_strip_cwd ${MY_FILE})" |
216 | MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
| 217 | |
217 | |
| 218 | einfo "(server owned) ${MY_FILE}" |
218 | einfo "(server owned) ${MY_FILE}" |
| 219 | echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" |
219 | echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" |
| 220 | done |
220 | done |
| 221 | done |
221 | done |
| 222 | else |
222 | else |
| 223 | for m in "$@" ; do |
223 | for m in "$@" ; do |
| 224 | webapp_checkfileexists "${m}" "$D" |
224 | webapp_checkfileexists "${m}" "$D" |
| 225 | local MY_FILE="$(webapp_strip_appdir ${m})" |
225 | local MY_FILE="$(webapp_strip_appdir "${m}")" |
| 226 | MY_FILE="$(webapp_strip_cwd ${MY_FILE})" |
226 | MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
| 227 | |
227 | |
| 228 | einfo "(server owned) ${MY_FILE}" |
228 | einfo "(server owned) ${MY_FILE}" |
| 229 | echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" |
229 | echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" |
| 230 | done |
230 | done |
| 231 | fi |
231 | fi |
| … | |
… | |
| 252 | # sort out what the name will be of the config file |
252 | # sort out what the name will be of the config file |
| 253 | |
253 | |
| 254 | local my_file |
254 | local my_file |
| 255 | |
255 | |
| 256 | if [ -z "${3}" ]; then |
256 | if [ -z "${3}" ]; then |
| 257 | my_file="${1}-$(basename ${2})" |
257 | my_file="${1}-$(basename "${2}")" |
| 258 | else |
258 | else |
| 259 | my_file="${1}-${3}" |
259 | my_file="${1}-${3}" |
| 260 | fi |
260 | fi |
| 261 | |
261 | |
| 262 | # warning: |
262 | # warning: |
| … | |
… | |
| 325 | chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" |
325 | chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" |
| 326 | chmod -R u-s "${D}/" |
326 | chmod -R u-s "${D}/" |
| 327 | chmod -R g-s "${D}/" |
327 | chmod -R g-s "${D}/" |
| 328 | |
328 | |
| 329 | keepdir "${MY_PERSISTDIR}" |
329 | keepdir "${MY_PERSISTDIR}" |
| 330 | fowners "root:root" "${MY_PERSISTDIR}" |
330 | fowners "root:0" "${MY_PERSISTDIR}" |
| 331 | fperms 755 "${MY_PERSISTDIR}" |
331 | fperms 755 "${MY_PERSISTDIR}" |
| 332 | |
332 | |
| 333 | # 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 |
| 334 | # we add an empty file to the filesystem |
334 | # we add an empty file to the filesystem |
| 335 | # |
335 | # |