Lines 1-6
Link Here
|
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/www/viewcvs.gentoo.org/raw_cvs/gentoo-x86/eclass/webapp.eclass,v 1.48 2007/01/03 20:16:39 rl03 Exp $ |
3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.48 2007/01/03 20:16:39 rl03 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 |
Lines 35-43
Link Here
|
35 |
|
35 |
|
36 |
INSTALL_CHECK_FILE="installed_by_webapp_eclass" |
36 |
INSTALL_CHECK_FILE="installed_by_webapp_eclass" |
37 |
|
37 |
|
38 |
ETC_CONFIG="${ROOT}/etc/vhosts/webapp-config" |
38 |
ETC_CONFIG="${EROOT}/etc/vhosts/webapp-config" |
39 |
WEBAPP_CONFIG="${ROOT}/usr/sbin/webapp-config" |
39 |
WEBAPP_CONFIG="${EROOT}/usr/sbin/webapp-config" |
40 |
WEBAPP_CLEANER="${ROOT}/usr/sbin/webapp-cleaner" |
40 |
WEBAPP_CLEANER="${EROOT}/usr/sbin/webapp-cleaner" |
41 |
|
41 |
|
42 |
# ------------------------------------------------------------------------ |
42 |
# ------------------------------------------------------------------------ |
43 |
# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
43 |
# INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
Lines 134-140
Link Here
|
134 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
134 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
135 |
|
135 |
|
136 |
elog "(config) ${MY_FILE}" |
136 |
elog "(config) ${MY_FILE}" |
137 |
echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST} |
137 |
echo "${MY_FILE}" >> ${ED}/${WA_CONFIGLIST#${EPREFIX}} |
138 |
done |
138 |
done |
139 |
} |
139 |
} |
140 |
|
140 |
|
Lines 152-159
Link Here
|
152 |
webapp_checkfileexists "${1}" |
152 |
webapp_checkfileexists "${1}" |
153 |
|
153 |
|
154 |
elog "(hook) ${1}" |
154 |
elog "(hook) ${1}" |
155 |
cp "${1}" "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" || die "Unable to install ${1} into ${D}/${MY_HOOKSCRIPTSDIR}/" |
155 |
cp "${1}" "${ED}/${MY_HOOKSCRIPTSDIR#${EPREFIX}}/$(basename "${1}")" || |
156 |
chmod 555 "${D}/${MY_HOOKSCRIPTSDIR}/$(basename "${1}")" |
156 |
die "Unable to install ${1} into ${ED}/${MY_HOOKSCRIPTSDIR#${EPREFIX}}/" |
|
|
157 |
chmod 555 "${ED}/${MY_HOOKSCRIPTSDIR#${EPREFIX}}/$(basename "${1}")" |
157 |
} |
158 |
} |
158 |
|
159 |
|
159 |
# ------------------------------------------------------------------------ |
160 |
# ------------------------------------------------------------------------ |
Lines 170-176
Link Here
|
170 |
webapp_checkfileexists "${2}" |
171 |
webapp_checkfileexists "${2}" |
171 |
|
172 |
|
172 |
elog "(info) ${2} (lang: ${1})" |
173 |
elog "(info) ${2} (lang: ${1})" |
173 |
cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt" |
174 |
cp "${2}" "${ED}/${MY_APPDIR#${EPREFIX}}/postinst-${1}.txt" |
174 |
} |
175 |
} |
175 |
|
176 |
|
176 |
# ------------------------------------------------------------------------ |
177 |
# ------------------------------------------------------------------------ |
Lines 187-193
Link Here
|
187 |
webapp_checkfileexists "${2}" |
188 |
webapp_checkfileexists "${2}" |
188 |
|
189 |
|
189 |
elog "(info) ${2} (lang: ${1})" |
190 |
elog "(info) ${2} (lang: ${1})" |
190 |
cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt" |
191 |
cp "${2}" "${ED}/${MY_APPDIR#${EPREFIX}}/postupgrade-${1}.txt" |
191 |
} |
192 |
} |
192 |
|
193 |
|
193 |
# ------------------------------------------------------------------------ |
194 |
# ------------------------------------------------------------------------ |
Lines 210-233
Link Here
|
210 |
if [ "${1}" = "-R" ]; then |
211 |
if [ "${1}" = "-R" ]; then |
211 |
shift |
212 |
shift |
212 |
for m in "$@" ; do |
213 |
for m in "$@" ; do |
213 |
for a in $(find ${D}/${m}); do |
214 |
for a in $(find ${ED}/${m}); do |
214 |
a=${a/${D}\/\///} |
215 |
a=${a/${ED}\/\///} |
215 |
webapp_checkfileexists "${a}" "$D" |
216 |
webapp_checkfileexists "${a}" "${D}" |
216 |
local MY_FILE="$(webapp_strip_appdir "${a}")" |
217 |
local MY_FILE="$(webapp_strip_appdir "${a}")" |
217 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
218 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
218 |
|
219 |
|
219 |
elog "(server owned) ${MY_FILE}" |
220 |
elog "(server owned) ${MY_FILE}" |
220 |
echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" |
221 |
echo "${MY_FILE}" >> "${ED}/${WA_SOLIST#${EPREFIX}}" |
221 |
done |
222 |
done |
222 |
done |
223 |
done |
223 |
else |
224 |
else |
224 |
for m in "$@" ; do |
225 |
for m in "$@" ; do |
225 |
webapp_checkfileexists "${m}" "$D" |
226 |
webapp_checkfileexists "${m}" "${D}" |
226 |
local MY_FILE="$(webapp_strip_appdir "${m}")" |
227 |
local MY_FILE="$(webapp_strip_appdir "${m}")" |
227 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
228 |
MY_FILE="$(webapp_strip_cwd "${MY_FILE}")" |
228 |
|
229 |
|
229 |
elog "(server owned) ${MY_FILE}" |
230 |
elog "(server owned) ${MY_FILE}" |
230 |
echo "${MY_FILE}" >> "${D}/${WA_SOLIST}" |
231 |
echo "${MY_FILE}" >> "${ED}/${WA_SOLIST#${EPREFIX}}" |
231 |
done |
232 |
done |
232 |
fi |
233 |
fi |
233 |
} |
234 |
} |
Lines 266-272
Link Here
|
266 |
# the other scripts that also rely upon these names |
267 |
# the other scripts that also rely upon these names |
267 |
|
268 |
|
268 |
elog "(${1}) config file '${my_file}'" |
269 |
elog "(${1}) config file '${my_file}'" |
269 |
cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}" |
270 |
cp "${2}" "${ED}/${MY_SERVERCONFIGDIR#${EPREFIX}}/${my_file}" |
270 |
} |
271 |
} |
271 |
|
272 |
|
272 |
# ------------------------------------------------------------------------ |
273 |
# ------------------------------------------------------------------------ |
Lines 290-297
Link Here
|
290 |
# scripts for specific database engines go into their own subdirectory |
291 |
# scripts for specific database engines go into their own subdirectory |
291 |
# just to keep things readable on the filesystem |
292 |
# just to keep things readable on the filesystem |
292 |
|
293 |
|
293 |
if [ ! -d "${D}/${MY_SQLSCRIPTSDIR}/${1}" ]; then |
294 |
if [ ! -d "${ED}/${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}" ]; then |
294 |
mkdir -p "${D}/${MY_SQLSCRIPTSDIR}/${1}" || die "unable to create directory ${D}/${MY_SQLSCRIPTSDIR}/${1}" |
295 |
mkdir -p "${ED}/${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}" || \ |
|
|
296 |
die "unable to create directory ${ED}/${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}" |
295 |
fi |
297 |
fi |
296 |
|
298 |
|
297 |
# warning: |
299 |
# warning: |
Lines 303-315
Link Here
|
303 |
if [ -n "${3}" ]; then |
305 |
if [ -n "${3}" ]; then |
304 |
# yes we are |
306 |
# yes we are |
305 |
elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}" |
307 |
elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}" |
306 |
cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" |
308 |
cp "${2}" "${ED}${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}/${3}_to_${PVR}.sql" |
307 |
chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" |
309 |
chmod 600 "${ED}${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}/${3}_to_${PVR}.sql" |
308 |
else |
310 |
else |
309 |
# no, we are not |
311 |
# no, we are not |
310 |
elog "(${1}) create script for ${PN}-${PVR}" |
312 |
elog "(${1}) create script for ${PN}-${PVR}" |
311 |
cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" |
313 |
cp "${2}" "${ED}/${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}/${PVR}_create.sql" |
312 |
chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" |
314 |
chmod 600 "${ED}/${MY_SQLSCRIPTSDIR#${EPREFIX}}/${1}/${PVR}_create.sql" |
313 |
fi |
315 |
fi |
314 |
} |
316 |
} |
315 |
|
317 |
|
Lines 323-335
Link Here
|
323 |
|
325 |
|
324 |
function webapp_src_install () |
326 |
function webapp_src_install () |
325 |
{ |
327 |
{ |
326 |
chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" |
328 |
#chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${ED}/" |
327 |
chmod -R u-s "${D}/" |
329 |
chmod -R u-s "${ED}/" |
328 |
chmod -R g-s "${D}/" |
330 |
chmod -R g-s "${ED}/" |
329 |
|
331 |
|
330 |
keepdir "${MY_PERSISTDIR}" |
332 |
keepdir "${MY_PERSISTDIR#${EPREFIX}}" |
331 |
fowners "root:0" "${MY_PERSISTDIR}" |
333 |
fowners "root:0" "${MY_PERSISTDIR#${EPREFIX}}" |
332 |
fperms 755 "${MY_PERSISTDIR}" |
334 |
fperms 755 "${MY_PERSISTDIR#${EPREFIX}}" |
333 |
|
335 |
|
334 |
# to test whether or not the ebuild has correctly called this function |
336 |
# to test whether or not the ebuild has correctly called this function |
335 |
# we add an empty file to the filesystem |
337 |
# we add an empty file to the filesystem |
Lines 338-344
Link Here
|
338 |
# no longer rely on Portage calling both webapp_src_install() and |
340 |
# no longer rely on Portage calling both webapp_src_install() and |
339 |
# webapp_pkg_postinst() within the same shell process |
341 |
# webapp_pkg_postinst() within the same shell process |
340 |
|
342 |
|
341 |
touch "${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE}" |
343 |
touch "${ED}/${MY_APPDIR#${EPREFIX}}/${INSTALL_CHECK_FILE}" |
342 |
} |
344 |
} |
343 |
|
345 |
|
344 |
# ------------------------------------------------------------------------ |
346 |
# ------------------------------------------------------------------------ |
Lines 367-373
Link Here
|
367 |
# non-webapp-config solution? |
369 |
# non-webapp-config solution? |
368 |
|
370 |
|
369 |
if ! use vhosts ; then |
371 |
if ! use vhosts ; then |
370 |
local my_dir="${ROOT}${VHOST_ROOT}/${MY_HTDOCSBASE}/${PN}" |
372 |
local my_dir="${EROOT}${VHOST_ROOT}/${MY_HTDOCSBASE#${EPREFIX}}/${PN}" |
371 |
local my_output |
373 |
local my_output |
372 |
|
374 |
|
373 |
if [ -d "${my_dir}" ] ; then |
375 |
if [ -d "${my_dir}" ] ; then |
Lines 433-446
Link Here
|
433 |
{ |
435 |
{ |
434 |
# create the directories that we need |
436 |
# create the directories that we need |
435 |
|
437 |
|
436 |
dodir "${MY_HTDOCSDIR}" |
438 |
dodir "${MY_HTDOCSDIR#${EPREFIX}}" |
437 |
dodir "${MY_HOSTROOTDIR}" |
439 |
dodir "${MY_HOSTROOTDIR#${EPREFIX}}" |
438 |
dodir "${MY_CGIBINDIR}" |
440 |
dodir "${MY_CGIBINDIR#${EPREFIX}}" |
439 |
dodir "${MY_ICONSDIR}" |
441 |
dodir "${MY_ICONSDIR#${EPREFIX}}" |
440 |
dodir "${MY_ERRORSDIR}" |
442 |
dodir "${MY_ERRORSDIR#${EPREFIX}}" |
441 |
dodir "${MY_SQLSCRIPTSDIR}" |
443 |
dodir "${MY_SQLSCRIPTSDIR#${EPREFIX}}" |
442 |
dodir "${MY_HOOKSCRIPTSDIR}" |
444 |
dodir "${MY_HOOKSCRIPTSDIR#${EPREFIX}}" |
443 |
dodir "${MY_SERVERCONFIGDIR}" |
445 |
dodir "${MY_SERVERCONFIGDIR#${EPREFIX}}" |
444 |
} |
446 |
} |
445 |
|
447 |
|
446 |
function webapp_pkg_postinst () |
448 |
function webapp_pkg_postinst () |
Lines 449-455
Link Here
|
449 |
|
451 |
|
450 |
# sanity checks, to catch bugs in the ebuild |
452 |
# sanity checks, to catch bugs in the ebuild |
451 |
|
453 |
|
452 |
if [ ! -f "${ROOT}${MY_APPDIR}/${INSTALL_CHECK_FILE}" ]; then |
454 |
if [ ! -f "${EROOT}${MY_APPDIR#${EPREFIX}}/${INSTALL_CHECK_FILE}" ]; then |
453 |
eerror |
455 |
eerror |
454 |
eerror "This ebuild did not call webapp_src_install() at the end" |
456 |
eerror "This ebuild did not call webapp_src_install() at the end" |
455 |
eerror "of the src_install() function" |
457 |
eerror "of the src_install() function" |
Lines 463-469
Link Here
|
463 |
fi |
465 |
fi |
464 |
|
466 |
|
465 |
# if 'vhosts' is not set in your USE flags, we install a copy of |
467 |
# if 'vhosts' is not set in your USE flags, we install a copy of |
466 |
# this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you |
468 |
# this application in ${EROOT}/var/www/localhost/htdocs/${PN}/ for you |
467 |
|
469 |
|
468 |
if ! use vhosts ; then |
470 |
if ! use vhosts ; then |
469 |
echo |
471 |
echo |