| 1 | # Copyright 1999-2004 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 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.18 2004/05/17 22:44:35 stuart Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.20 2004/05/22 18:56:58 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 |
| … | |
… | |
| 21 | |
21 | |
| 22 | ECLASS=webapp |
22 | ECLASS=webapp |
| 23 | INHERITED="$INHERITED $ECLASS" |
23 | INHERITED="$INHERITED $ECLASS" |
| 24 | SLOT="${PVR}" |
24 | SLOT="${PVR}" |
| 25 | IUSE="$IUSE vhosts" |
25 | IUSE="$IUSE vhosts" |
| 26 | DEPEND="$DEPEND >=net-www/webapp-config-1.9 app-portage/gentoolkit" |
26 | DEPEND="$DEPEND >=net-www/webapp-config-1.7 app-portage/gentoolkit" |
| 27 | |
27 | |
| 28 | EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm |
28 | EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install pkg_prerm |
| 29 | |
29 | |
| 30 | INSTALL_DIR="/$PN" |
30 | INSTALL_DIR="/$PN" |
| 31 | IS_UPGRADE=0 |
31 | IS_UPGRADE=0 |
| 32 | IS_REPLACE=0 |
32 | IS_REPLACE=0 |
|
|
33 | |
|
|
34 | INSTALL_CHECK_FILE="installed_by_webapp_eclass" |
| 33 | |
35 | |
| 34 | # ------------------------------------------------------------------------ |
36 | # ------------------------------------------------------------------------ |
| 35 | # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
37 | # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
| 36 | # |
38 | # |
| 37 | # Check whether a specified file exists within the image/ directory |
39 | # Check whether a specified file exists within the image/ directory |
| … | |
… | |
| 299 | |
301 | |
| 300 | keepdir ${MY_PERSISTDIR} |
302 | keepdir ${MY_PERSISTDIR} |
| 301 | fowners root:root ${MY_PERSISTDIR} |
303 | fowners root:root ${MY_PERSISTDIR} |
| 302 | fperms 755 ${MY_PERSISTDIR} |
304 | fperms 755 ${MY_PERSISTDIR} |
| 303 | |
305 | |
| 304 | HAS_webapp_src_install=1 |
306 | # to test whether or not the ebuild has correctly called this function |
|
|
307 | # we add an empty file to the filesystem |
|
|
308 | # |
|
|
309 | # we used to just set a variable in the shell script, but we can |
|
|
310 | # no longer rely on Portage calling both webapp_src_install() and |
|
|
311 | # webapp_pkg_postinst() within the same shell process |
|
|
312 | |
|
|
313 | touch ${D}/${MY_APPDIR}/${INSTALL_CHECK_FILE} |
| 305 | } |
314 | } |
| 306 | |
315 | |
| 307 | # ------------------------------------------------------------------------ |
316 | # ------------------------------------------------------------------------ |
| 308 | # EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER |
317 | # EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER |
| 309 | # everything else has run |
318 | # everything else has run |
| … | |
… | |
| 343 | # okay, whatever is there, it isn't webapp-config-compatible |
352 | # okay, whatever is there, it isn't webapp-config-compatible |
| 344 | ewarn |
353 | ewarn |
| 345 | ewarn "Whatever is in $my_dir, it's not" |
354 | ewarn "Whatever is in $my_dir, it's not" |
| 346 | ewarn "compatible with webapp-config." |
355 | ewarn "compatible with webapp-config." |
| 347 | ewarn |
356 | ewarn |
| 348 | |
357 | ewarn "This ebuild may be overwriting important files." |
| 349 | my_output="`qpkg -nc -v -f $my_dir`" |
358 | ewarn |
| 350 | if [ -n "$my_output" ]; then |
|
|
| 351 | eerror "Please remove $my_output and re-emerge." |
|
|
| 352 | else |
|
|
| 353 | eerror "Please remove the contents of $my_dir, and then re-emerge." |
|
|
| 354 | fi |
|
|
| 355 | die "Cannot upgrade contents of $my_dir" |
|
|
| 356 | elif [ "`echo $my_output | awk '{ print $1 }'`" != "$PN" ]; then |
359 | elif [ "`echo $my_output | awk '{ print $1 }'`" != "$PN" ]; then |
| 357 | eerror "$my_dir contains $my_output" |
360 | eerror "$my_dir contains $my_output" |
| 358 | eerror "I cannot upgrade that" |
361 | eerror "I cannot upgrade that" |
| 359 | die "Cannot upgrade contents of $my_dir" |
362 | die "Cannot upgrade contents of $my_dir" |
| 360 | else |
363 | else |
| … | |
… | |
| 429 | |
432 | |
| 430 | function webapp_pkg_postinst () |
433 | function webapp_pkg_postinst () |
| 431 | { |
434 | { |
| 432 | # sanity checks, to catch bugs in the ebuild |
435 | # sanity checks, to catch bugs in the ebuild |
| 433 | |
436 | |
| 434 | if [ "$HAS_webapp_src_install+" == "+" ]; then |
437 | if [ ! -f ${MY_APPDIR}/${INSTALL_CHECK_FILE} ]; then |
| 435 | eerror |
438 | eerror |
| 436 | eerror "This ebuild did not call webapp_src_install() at the end" |
439 | eerror "This ebuild did not call webapp_src_install() at the end" |
| 437 | eerror "of the src_install() function" |
440 | eerror "of the src_install() function" |
| 438 | eerror |
441 | eerror |
| 439 | eerror "Please log a bug on http://bugs.gentoo.org" |
442 | eerror "Please log a bug on http://bugs.gentoo.org" |