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

Diff of /eclass/webapp.eclass

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

Revision 1.42 Revision 1.43
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.42 2006/06/15 07:01:01 stuart Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.43 2006/07/10 00:52:34 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
7# 7#
8# Part of the implementation of GLEP #11 8# Part of the implementation of GLEP #11
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 elog "(config) ${MY_FILE}"
136 echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST} 136 echo "${MY_FILE}" >> ${D}/${WA_CONFIGLIST}
137 done 137 done
138} 138}
139 139
140# ------------------------------------------------------------------------ 140# ------------------------------------------------------------------------
148 148
149function webapp_hook_script () 149function webapp_hook_script ()
150{ 150{
151 webapp_checkfileexists "${1}" 151 webapp_checkfileexists "${1}"
152 152
153 einfo "(hook) ${1}" 153 elog "(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# ------------------------------------------------------------------------
166 166
167function webapp_postinst_txt () 167function webapp_postinst_txt ()
168{ 168{
169 webapp_checkfileexists "${2}" 169 webapp_checkfileexists "${2}"
170 170
171 einfo "(info) ${2} (lang: ${1})" 171 elog "(info) ${2} (lang: ${1})"
172 cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt" 172 cp "${2}" "${D}/${MY_APPDIR}/postinst-${1}.txt"
173} 173}
174 174
175# ------------------------------------------------------------------------ 175# ------------------------------------------------------------------------
176# EXPORTED FUNCTION - FOR USE IN EBUILDS 176# EXPORTED FUNCTION - FOR USE IN EBUILDS
183 183
184function webapp_postupgrade_txt () 184function webapp_postupgrade_txt ()
185{ 185{
186 webapp_checkfileexists "${2}" 186 webapp_checkfileexists "${2}"
187 187
188 einfo "(info) ${2} (lang: ${1})" 188 elog "(info) ${2} (lang: ${1})"
189 cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt" 189 cp "${2}" "${D}/${MY_APPDIR}/postupgrade-${1}.txt"
190} 190}
191 191
192# ------------------------------------------------------------------------ 192# ------------------------------------------------------------------------
193# EXPORTED FUNCTION - FOR USE IN EBUILDS 193# EXPORTED FUNCTION - FOR USE IN EBUILDS
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 elog "(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 elog "(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
232} 232}
233 233
262 # warning: 262 # warning:
263 # 263 #
264 # do NOT change the naming convention used here without changing all 264 # do NOT change the naming convention used here without changing all
265 # the other scripts that also rely upon these names 265 # the other scripts that also rely upon these names
266 266
267 einfo "(${1}) config file '${my_file}'" 267 elog "(${1}) config file '${my_file}'"
268 cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}" 268 cp "${2}" "${D}/${MY_SERVERCONFIGDIR}/${my_file}"
269} 269}
270 270
271# ------------------------------------------------------------------------ 271# ------------------------------------------------------------------------
272# EXPORTED FUNCTION - FOR USE IN EBUILDS 272# EXPORTED FUNCTION - FOR USE IN EBUILDS
299 # the other scripts that also rely upon these names 299 # the other scripts that also rely upon these names
300 300
301 # are we dealing with an 'upgrade'-type script? 301 # are we dealing with an 'upgrade'-type script?
302 if [ -n "${3}" ]; then 302 if [ -n "${3}" ]; then
303 # yes we are 303 # yes we are
304 einfo "(${1}) upgrade script from ${PN}-${PVR} to ${3}" 304 elog "(${1}) upgrade script from ${PN}-${PVR} to ${3}"
305 cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" 305 cp "${2}" "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
306 chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql" 306 chmod 600 "${D}${MY_SQLSCRIPTSDIR}/${1}/${3}_to_${PVR}.sql"
307 else 307 else
308 # no, we are not 308 # no, we are not
309 einfo "(${1}) create script for ${PN}-${PVR}" 309 elog "(${1}) create script for ${PN}-${PVR}"
310 cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" 310 cp "${2}" "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
311 chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql" 311 chmod 600 "${D}/${MY_SQLSCRIPTSDIR}/${1}/${PVR}_create.sql"
312 fi 312 fi
313} 313}
314 314
419 419
420 REMOVE_PKG="${my_pn}-${my_pvr}" 420 REMOVE_PKG="${my_pn}-${my_pvr}"
421 421
422 if [ "${my_pn}" == "${PN}" ]; then 422 if [ "${my_pn}" == "${PN}" ]; then
423 if [ "${my_pvr}" != "${PVR}" ]; then 423 if [ "${my_pvr}" != "${PVR}" ]; then
424 einfo "This is an upgrade" 424 elog "This is an upgrade"
425 IS_UPGRADE=1 425 IS_UPGRADE=1
426 else 426 else
427 einfo "This is a re-installation" 427 elog "This is a re-installation"
428 IS_REPLACE=1 428 IS_REPLACE=1
429 fi 429 fi
430 else 430 else
431 einfo "${my_output} is installed there" 431 elog "${my_output} is installed there"
432 fi 432 fi
433 else 433 else
434 einfo "This is an installation" 434 elog "This is an installation"
435 fi 435 fi
436 fi 436 fi
437} 437}
438 438
439function webapp_src_preinst () 439function webapp_src_preinst ()
472 # if 'vhosts' is not set in your USE flags, we install a copy of 472 # if 'vhosts' is not set in your USE flags, we install a copy of
473 # this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you 473 # this application in ${ROOT}/var/www/localhost/htdocs/${PN}/ for you
474 474
475 if ! use vhosts ; then 475 if ! use vhosts ; then
476 echo 476 echo
477 einfo "vhosts USE flag not set - auto-installing using webapp-config" 477 elog "vhosts USE flag not set - auto-installing using webapp-config"
478 478
479 webapp_getinstalltype 479 webapp_getinstalltype
480 480
481 G_HOSTNAME="localhost" 481 G_HOSTNAME="localhost"
482 local my_mode=-I 482 local my_mode=-I
483 webapp_read_config 483 webapp_read_config
484 484
485 if [ "${IS_REPLACE}" = "1" ]; then 485 if [ "${IS_REPLACE}" = "1" ]; then
486 einfo "${PN}-${PVR} is already installed - replacing" 486 elog "${PN}-${PVR} is already installed - replacing"
487 my_mode=-I 487 my_mode=-I
488 elif [ "${IS_UPGRADE}" = "1" ]; then 488 elif [ "${IS_UPGRADE}" = "1" ]; then
489 einfo "${REMOVE_PKG} is already installed - upgrading" 489 elog "${REMOVE_PKG} is already installed - upgrading"
490 my_mode=-U 490 my_mode=-U
491 else 491 else
492 einfo "${PN}-${PVR} is not installed - using install mode" 492 elog "${PN}-${PVR} is not installed - using install mode"
493 fi 493 fi
494 494
495 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}" 495 my_cmd="${WEBAPP_CONFIG} ${my_mode} -h localhost -u root -d ${INSTALL_DIR} ${PN} ${PVR}"
496 einfo "Running ${my_cmd}" 496 elog "Running ${my_cmd}"
497 ${my_cmd} 497 ${my_cmd}
498 498
499 # remove the old version 499 # remove the old version
500 # 500 #
501 # why do we do this? well ... 501 # why do we do this? well ...
506 # 506 #
507 # if USE=-vhosts, then we want to remove the old version, because 507 # if USE=-vhosts, then we want to remove the old version, because
508 # the user is relying on portage to do the magical thing for it 508 # the user is relying on portage to do the magical thing for it
509 509
510 if [ "${IS_UPGRADE}" = "1" ] ; then 510 if [ "${IS_UPGRADE}" = "1" ] ; then
511 einfo "Removing old version ${REMOVE_PKG}" 511 elog "Removing old version ${REMOVE_PKG}"
512 512
513 emerge -C "${REMOVE_PKG}" 513 emerge -C "${REMOVE_PKG}"
514 fi 514 fi
515 else 515 else
516 # vhosts flag is on 516 # vhosts flag is on
517 # 517 #
518 # let's tell the administrator what to do next 518 # let's tell the administrator what to do next
519 519
520 einfo 520 elog
521 einfo "The 'vhosts' USE flag is switched ON" 521 elog "The 'vhosts' USE flag is switched ON"
522 einfo "This means that Portage will not automatically run webapp-config to" 522 elog "This means that Portage will not automatically run webapp-config to"
523 einfo "complete the installation." 523 elog "complete the installation."
524 einfo 524 elog
525 einfo "To install ${PN}-${PVR} into a virtual host, run the following command:" 525 elog "To install ${PN}-${PVR} into a virtual host, run the following command:"
526 einfo 526 elog
527 einfo " webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}" 527 elog " webapp-config -I -h <host> -d ${PN} ${PN} ${PVR}"
528 einfo 528 elog
529 einfo "For more details, see the webapp-config(8) man page" 529 elog "For more details, see the webapp-config(8) man page"
530 fi 530 fi
531 531
532 return 0 532 return 0
533} 533}
534 534

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

  ViewVC Help
Powered by ViewVC 1.1.20