| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
| 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.8 2004/04/23 14:19:35 stuart Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.9 2004/04/23 22:02:27 stuart 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 |
| … | |
… | |
| 18 | |
18 | |
| 19 | ECLASS=webapp |
19 | ECLASS=webapp |
| 20 | INHERITED="$INHERITED $ECLASS" |
20 | INHERITED="$INHERITED $ECLASS" |
| 21 | SLOT="${PVR}" |
21 | SLOT="${PVR}" |
| 22 | IUSE="$IUSE vhosts" |
22 | IUSE="$IUSE vhosts" |
| 23 | DEPEND="$DEPEND >=net-www/webapp-config-1.3" |
23 | DEPEND="$DEPEND >=net-www/webapp-config-1.4" |
| 24 | |
24 | |
| 25 | EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install |
25 | EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install |
| 26 | |
26 | |
| 27 | # ------------------------------------------------------------------------ |
27 | # ------------------------------------------------------------------------ |
| 28 | # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
28 | # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
| … | |
… | |
| 35 | # @return 0 on success, never returns on an error |
35 | # @return 0 on success, never returns on an error |
| 36 | # ------------------------------------------------------------------------ |
36 | # ------------------------------------------------------------------------ |
| 37 | |
37 | |
| 38 | function webapp_checkfileexists () |
38 | function webapp_checkfileexists () |
| 39 | { |
39 | { |
|
|
40 | local my_prefix |
|
|
41 | |
|
|
42 | [ -n "$2" ] && my_prefix="$2/" || my_prefix= |
|
|
43 | |
| 40 | if [ ! -e $1 ]; then |
44 | if [ ! -e ${my_prefix}$1 ]; then |
| 41 | msg="ebuild fault: file $1 not found" |
45 | msg="ebuild fault: file $1 not found" |
| 42 | eerror "$msg" |
46 | eerror "$msg" |
| 43 | eerror "Please report this as a bug at http://bugs.gentoo.org/" |
47 | eerror "Please report this as a bug at http://bugs.gentoo.org/" |
| 44 | die "$msg" |
48 | die "$msg" |
| 45 | fi |
49 | fi |
| … | |
… | |
| 241 | if [ -d "${D}${MY_APPROOT}/${MY_APPSUFFIX}" ]; then |
245 | if [ -d "${D}${MY_APPROOT}/${MY_APPSUFFIX}" ]; then |
| 242 | # yes we are |
246 | # yes we are |
| 243 | ewarn "Removing existing copy of ${PN}-${PVR}" |
247 | ewarn "Removing existing copy of ${PN}-${PVR}" |
| 244 | rm -rf "${D}${MY_APPROOT}/${MY_APPSUFFIX}" |
248 | rm -rf "${D}${MY_APPROOT}/${MY_APPSUFFIX}" |
| 245 | fi |
249 | fi |
|
|
250 | } |
| 246 | |
251 | |
|
|
252 | function webapp_src_preinst () |
|
|
253 | { |
| 247 | # create the directories that we need |
254 | # create the directories that we need |
| 248 | |
255 | |
| 249 | mkdir -p ${D}${MY_HTDOCSDIR} |
256 | dodir ${MY_HTDOCSDIR} |
| 250 | mkdir -p ${D}${MY_HOSTROOTDIR} |
257 | dodir ${MY_HOSTROOTDIR} |
| 251 | mkdir -p ${D}${MY_CGIBINDIR} |
258 | dodir ${MY_CGIBINDIR} |
| 252 | mkdir -p ${D}${MY_ICONSDIR} |
259 | dodir ${MY_ICONSDIR} |
| 253 | mkdir -p ${D}${MY_ERRORSDIR} |
260 | dodir ${MY_ERRORSDIR} |
| 254 | mkdir -p ${D}${MY_SQLSCRIPTSDIR} |
261 | dodir ${MY_SQLSCRIPTSDIR} |
| 255 | } |
262 | } |
| 256 | |
263 | |
| 257 | function webapp_pkg_postinst () |
264 | function webapp_pkg_postinst () |
| 258 | { |
265 | { |
| 259 | G_HOSTNAME="localhost" |
266 | G_HOSTNAME="localhost" |
| 260 | . /etc/vhosts/webapp-config |
267 | . /etc/vhosts/webapp-config |
| 261 | |
268 | |
| 262 | use vhosts || /usr/sbin/webapp-config -I -u root -d "${VHOST_ROOT}/htdocs/${PN}/" ${PN} ${PVR} |
269 | use vhosts || /usr/sbin/webapp-config -I -u root -h localhost -d "${VHOST_ROOT}/htdocs/${PN}/" ${PN} ${PVR} |
| 263 | } |
270 | } |