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

Contents of /eclass/webapp.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Oct 7 21:54:46 2003 UTC (11 years ago) by stuart
Branch: MAIN
initial import; for review

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/webapp-apache.eclass,v 1.9 2003/08/20 10:19:46 stuart Exp $
4 #
5 # eclass/webapp.eclass
6 # Eclass for installing applications to run under a web server
7 #
8 # Part of the implementation of GLEP #11
9 #
10 # Author(s) Stuart Herbert <stuart@gentoo.org>
11 #
12 # ------------------------------------------------------------------------
13 #
14 # Please do not make modifications to this file without checking with a
15 # member of the web-apps herd first!
16 #
17 # ------------------------------------------------------------------------
18 #
19 # THIS IS A BETA RELEASE ONLY. ALL DETAILS ARE SUBJECT TO CHANGE BEFORE
20 # WE ARE READY TO START PORTING EVERYTHING TO THIS ECLASS
21 #
22 # ------------------------------------------------------------------------
23
24 ECLASS=webapp
25 INHERITED="$INHERITED $ECLASS"
26 #DEPEND="${DEPEND} net-www/apache"
27 SLOT="${PVR}"
28 IUSE="$IUSE vhosts"
29
30 if [ -f /usr/share/webapp-config/settings.sh ] ; then
31 . /usr/share/webapp-config/settings.sh
32 fi
33
34 EXPORT_FUNCTIONS pkg_setup src_install
35
36 # ------------------------------------------------------------------------
37 # INTERNAL FUNCTION - USED BY THIS ECLASS ONLY
38 #
39 # Check whether a specified file exists within the image/ directory
40 # or not.
41 #
42 # @param $1 - file to look for
43 # @return 0 on success, never returns on an error
44 # ------------------------------------------------------------------------
45
46 function webapp_checkfileexists ()
47 {
48 if [ ! -e ${D}/$1 ]; then
49 msg="ebuild fault: file $1 not found in ${D}"
50 eerror "$msg"
51 eerror "Please report this as a bug at http://bugs.gentoo.org/"
52 die "$msg"
53 fi
54 }
55
56 # ------------------------------------------------------------------------
57 # EXPORTED FUNCTION - FOR USE IN EBUILDS
58 #
59 # Identify a file which must be owned by the webserver's user:group
60 # settings.
61 #
62 # The ownership of the file is NOT set until the application is installed
63 # using the webapp-config tool.
64 #
65 # @param $1 - file to be owned by the webserver user:group combo
66 #
67 # ------------------------------------------------------------------------
68
69 function webapp_serverowned ()
70 {
71 webapp_checkfileexists $1
72 echo "$1" >> $WA_SOLIST
73 }
74
75 # ------------------------------------------------------------------------
76 # EXPORTED FUNCTION - FOR USE IN EBUILDS
77 #
78 # Identify a config file for a web-based application.
79 #
80 # @param $1 - config file
81 # ------------------------------------------------------------------------
82
83 function webapp_configfile ()
84 {
85 webapp_checkfileexists $1
86 echo "$1" >> $WA_CONFIGLIST
87 }
88
89 # ------------------------------------------------------------------------
90 # EXPORTED FUNCTION - FOR USE IN EBUILDS
91 #
92 # Identify a script file (usually, but not always PHP or Perl) which is
93 #
94 # Files in this list may be modified to #! the required CGI engine when
95 # installed by webapp-config tool in the future.
96 #
97 # @param $1 - the cgi engine to use
98 # @param $2 - the script file that could run under a cgi-bin
99 #
100 # ------------------------------------------------------------------------
101
102 function webapp_runbycgibin ()
103 {
104 webapp_checkfileexists $2
105 echo "$1 $2" >> $WA_RUNBYCGIBINLIST
106 }
107
108 # ------------------------------------------------------------------------
109 # EXPORTED FUNCTION - call from inside your ebuild's src_install AFTER
110 # everything else has run
111 #
112 # For now, we just make sure that root owns everything, and that there
113 # are no setuid files. I'm sure this will change significantly before
114 # the final version!
115 # ------------------------------------------------------------------------
116
117 function webapp_src_install ()
118 {
119 chown -R root:root ${D}/
120 chmod -R u-s ${D}/
121 chmod -R g-s ${D}/
122 }
123
124 # ------------------------------------------------------------------------
125 # EXPORTED FUNCTION - call from inside your ebuild's pkg_setup AFTER
126 # everything else has run
127 #
128 # If 'vhosts' USE flag is not set, auto-install this app
129 #
130 # ------------------------------------------------------------------------
131
132 function webapp_pkg_setup ()
133 {
134 use vhosts || webapp-config -u root -d /var/www/localhost/htdocs/${PN}/ ${PN}

  ViewVC Help
Powered by ViewVC 1.1.20