| 1 | # Copyright 1999-2004 Gentoo Foundation |
1 | # Copyright 1999-2004 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.30 2005/05/10 22:55:17 beu Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.31 2005/05/30 21:44:17 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.10-r14 app-portage/gentoolkit" |
26 | DEPEND="$DEPEND net-www/webapp-config 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 |
| … | |
… | |
| 152 | # |
152 | # |
| 153 | # @param $1 - language code (use 'en' for now) |
153 | # @param $1 - language code (use 'en' for now) |
| 154 | # @param $2 - the file to install |
154 | # @param $2 - the file to install |
| 155 | # ------------------------------------------------------------------------ |
155 | # ------------------------------------------------------------------------ |
| 156 | |
156 | |
| 157 | function webapp_postinst_txt |
157 | function webapp_postinst_txt () |
| 158 | { |
158 | { |
| 159 | webapp_checkfileexists "$2" |
159 | webapp_checkfileexists "$2" |
| 160 | |
160 | |
| 161 | einfo "(rtfm) $2 (lang: $1)" |
161 | einfo "(rtfm) $2 (lang: $1)" |
| 162 | cp "$2" "${D}${MY_APPDIR}/postinst-$1.txt" |
162 | cp "$2" "${D}${MY_APPDIR}/postinst-$1.txt" |
| 163 | } |
163 | } |
| 164 | |
164 | |
| 165 | # ------------------------------------------------------------------------ |
165 | # ------------------------------------------------------------------------ |
| 166 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
166 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
| 167 | # |
167 | # |
| 168 | # Identify a script file (usually, but not always PHP or Perl) which is |
168 | # Install a text file containing post-upgrade instructions. |
| 169 | # |
169 | # |
| 170 | # Files in this list may be modified to #! the required CGI engine when |
170 | # @param $1 - language code (use 'en' for now) |
| 171 | # installed by webapp-config tool in the future. |
171 | # @param $2 - the file to install |
| 172 | # |
|
|
| 173 | # @param $1 - the cgi engine to use |
|
|
| 174 | # @param $2 - the script file that could run under a cgi-bin |
|
|
| 175 | # |
|
|
| 176 | # ------------------------------------------------------------------------ |
172 | # ------------------------------------------------------------------------ |
|
|
173 | |
|
|
174 | function webapp_postupgrade_txt () |
|
|
175 | { |
|
|
176 | webapp_checkfileexists "$2" |
|
|
177 | |
|
|
178 | einfo "(rtfm) $2 (lang: $1)" |
|
|
179 | cp "$2" "${D}${MY_APPDIR}/postupgrade-$1.txt" |
|
|
180 | } |
|
|
181 | |
|
|
182 | # ------------------------------------------------------------------------ |
|
|
183 | # DEPRECATED FUNCTION |
|
|
184 | # |
|
|
185 | # It never worked anyway |
| 177 | |
186 | |
| 178 | function webapp_runbycgibin () |
187 | function webapp_runbycgibin () |
| 179 | { |
188 | { |
| 180 | webapp_checkfileexists "$2" "$D" |
189 | if [ -n "$WARN_RUNBYCGIBIN" ] ; then |
| 181 | local MY_FILE="`webapp_strip_appdir \"$2\"`" |
190 | return |
| 182 | MY_FILE="`webapp_strip_cwd \"$MY_FILE\"`" |
191 | fi |
| 183 | |
192 | |
| 184 | einfo "(cgi-bin) $1 - $MY_FILE" |
193 | ewarn "This ebuild uses webapp.eclass's webapp_runbycgibin, which is now" |
| 185 | echo "\"$1\" \"$MY_FILE\"" >> "${D}${WA_RUNBYCGIBINLIST}" |
194 | ewarn "deprecated. Please file a bug about this in Bugzilla." |
|
|
195 | WARN_RUNBYCGIBIN=1 |
| 186 | } |
196 | } |
| 187 | |
197 | |
| 188 | # ------------------------------------------------------------------------ |
198 | # ------------------------------------------------------------------------ |
| 189 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
199 | # EXPORTED FUNCTION - FOR USE IN EBUILDS |
| 190 | # |
200 | # |
| … | |
… | |
| 278 | # are we dealing with an 'upgrade'-type script? |
288 | # are we dealing with an 'upgrade'-type script? |
| 279 | if [ -n "$3" ]; then |
289 | if [ -n "$3" ]; then |
| 280 | # yes we are |
290 | # yes we are |
| 281 | einfo "($1) upgrade script from ${PN}-${PVR} to $3" |
291 | einfo "($1) upgrade script from ${PN}-${PVR} to $3" |
| 282 | cp "$2" "${D}${MY_SQLSCRIPTSDIR}/$1/${3}_to_${PVR}.sql" |
292 | cp "$2" "${D}${MY_SQLSCRIPTSDIR}/$1/${3}_to_${PVR}.sql" |
|
|
293 | chmod 600 "${D}${MY_SQLSCRIPTSDIR}/$1/${3}_to_${PVR}.sql" |
| 283 | else |
294 | else |
| 284 | # no, we are not |
295 | # no, we are not |
| 285 | einfo "($1) create script for ${PN}-${PVR}" |
296 | einfo "($1) create script for ${PN}-${PVR}" |
| 286 | cp "$2" "${D}${MY_SQLSCRIPTSDIR}/$1/${PVR}_create.sql" |
297 | cp "$2" "${D}${MY_SQLSCRIPTSDIR}/$1/${PVR}_create.sql" |
|
|
298 | chmod 600 "${D}${MY_SQLSCRIPTSDIR}/$1/${PVR}_create.sql" |
| 287 | fi |
299 | fi |
| 288 | } |
300 | } |
| 289 | |
301 | |
| 290 | # ------------------------------------------------------------------------ |
302 | # ------------------------------------------------------------------------ |
| 291 | # EXPORTED FUNCTION - call from inside your ebuild's src_install AFTER |
303 | # EXPORTED FUNCTION - call from inside your ebuild's src_install AFTER |