| 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.4 2004/03/03 18:44:34 stuart Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.5 2004/04/14 16:02:37 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 | G_HASCONFIG=1 |
|
|
| 24 | |
23 | |
| 25 | if [ -f /etc/conf.d/webapp-config ] ; then |
24 | if [ -f /etc/vhosts/webapp-config ] ; then |
| 26 | . /etc/conf.d/webapp-config |
25 | . /etc/vhosts/webapp-config |
| 27 | else |
26 | else |
| 28 | G_HASCONFIG=0 |
27 | die "Unable to open /etc/vhosts/webapp-config file" |
| 29 | fi |
28 | fi |
| 30 | |
29 | |
| 31 | EXPORT_FUNCTIONS pkg_config pkg_setup src_install |
30 | EXPORT_FUNCTIONS pkg_postinst pkg_setup src_install |
| 32 | |
31 | |
| 33 | # ------------------------------------------------------------------------ |
32 | # ------------------------------------------------------------------------ |
| 34 | # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
33 | # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY |
| 35 | # |
34 | # |
| 36 | # Check whether a specified file exists within the image/ directory |
35 | # Check whether a specified file exists within the image/ directory |
| … | |
… | |
| 99 | webapp_checkfileexists "$1" "$D" |
98 | webapp_checkfileexists "$1" "$D" |
| 100 | local MY_FILE="`webapp_strip_appdir $1`" |
99 | local MY_FILE="`webapp_strip_appdir $1`" |
| 101 | |
100 | |
| 102 | einfo "(config) $MY_FILE" |
101 | einfo "(config) $MY_FILE" |
| 103 | echo "$MY_FILE" >> $WA_CONFIGLIST |
102 | echo "$MY_FILE" >> $WA_CONFIGLIST |
|
|
103 | } |
|
|
104 | |
|
|
105 | # ------------------------------------------------------------------------ |
|
|
106 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
|
|
107 | # |
|
|
108 | # Install a text file containing post-installation instructions. |
|
|
109 | # |
|
|
110 | # @param $1 - language code (use 'en' for now) |
|
|
111 | # @param $2 - the file to install |
|
|
112 | # ------------------------------------------------------------------------ |
|
|
113 | |
|
|
114 | function webapp_postinst_txt |
|
|
115 | { |
|
|
116 | webapp_checkfileexists "$2" |
|
|
117 | |
|
|
118 | einfo "(rtfm) $2 (lang: $1)" |
|
|
119 | cp "$2" "${MY_APPDIR}/postinst-$1.txt" |
| 104 | } |
120 | } |
| 105 | |
121 | |
| 106 | # ------------------------------------------------------------------------ |
122 | # ------------------------------------------------------------------------ |
| 107 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
123 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
| 108 | # |
124 | # |
| … | |
… | |
| 203 | function webapp_src_install () |
219 | function webapp_src_install () |
| 204 | { |
220 | { |
| 205 | chown -R root:root ${D}/ |
221 | chown -R root:root ${D}/ |
| 206 | chmod -R u-s ${D}/ |
222 | chmod -R u-s ${D}/ |
| 207 | chmod -R g-s ${D}/ |
223 | chmod -R g-s ${D}/ |
|
|
224 | |
|
|
225 | keepdir ${MY_PERSISTDIR} |
|
|
226 | fowners root:root ${MY_PERSISTDIR} |
|
|
227 | fperms 755 ${MY_PERSISTDIR} |
| 208 | } |
228 | } |
| 209 | |
229 | |
| 210 | # ------------------------------------------------------------------------ |
230 | # ------------------------------------------------------------------------ |
| 211 | # EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER |
231 | # EXPORTED FUNCTION - call from inside your ebuild's pkg_config AFTER |
| 212 | # everything else has run |
232 | # everything else has run |
| … | |
… | |
| 215 | # |
235 | # |
| 216 | # ------------------------------------------------------------------------ |
236 | # ------------------------------------------------------------------------ |
| 217 | |
237 | |
| 218 | function webapp_pkg_setup () |
238 | function webapp_pkg_setup () |
| 219 | { |
239 | { |
| 220 | # we do have the config file, right? |
|
|
| 221 | |
|
|
| 222 | if [ "$G_HASCONFIG" = "0" ]; then |
|
|
| 223 | die "/etc/conf.d/webapp-config missing" |
|
|
| 224 | fi |
|
|
| 225 | |
|
|
| 226 | # are we emerging something that is already installed? |
240 | # are we emerging something that is already installed? |
| 227 | |
241 | |
| 228 | if [ -d "${MY_APPROOT}/${MY_APPSUFFIX}" ]; then |
242 | if [ -d "${MY_APPROOT}/${MY_APPSUFFIX}" ]; then |
| 229 | # yes we are |
243 | # yes we are |
| 230 | ewarn "Removing existing copy of ${PN}-${PVR}" |
244 | ewarn "Removing existing copy of ${PN}-${PVR}" |
| … | |
… | |
| 239 | mkdir -p ${MY_ICONSDIR} |
253 | mkdir -p ${MY_ICONSDIR} |
| 240 | mkdir -p ${MY_ERRORSDIR} |
254 | mkdir -p ${MY_ERRORSDIR} |
| 241 | mkdir -p ${MY_SQLSCRIPTSDIR} |
255 | mkdir -p ${MY_SQLSCRIPTSDIR} |
| 242 | } |
256 | } |
| 243 | |
257 | |
| 244 | function webapp_pkg_config () |
258 | function webapp_pkg_postinst () |
| 245 | { |
259 | { |
| 246 | use vhosts || webapp-config -u root -d /var/www/localhost/htdocs/${PN}/ ${PN} |
260 | G_HOSTNAME="${VHOST_HOSTNAME}" |
|
|
261 | use vhosts || /usr/sbin/webapp-config -I -u root -d "${VHOST_ROOT}/htdocs/${PN}/" ${PN} ${PVR} |
| 247 | } |
262 | } |