1 |
hollow 08/02/22 10:03:55 |
2 |
|
3 |
Modified: webapp.eclass |
4 |
Log: |
5 |
document missing parts |
6 |
|
7 |
Revision Changes Path |
8 |
1.50 eclass/webapp.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.50&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?rev=1.50&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/webapp.eclass?r1=1.49&r2=1.50 |
13 |
|
14 |
Index: webapp.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v |
17 |
retrieving revision 1.49 |
18 |
retrieving revision 1.50 |
19 |
diff -u -r1.49 -r1.50 |
20 |
--- webapp.eclass 22 Feb 2008 09:33:45 -0000 1.49 |
21 |
+++ webapp.eclass 22 Feb 2008 10:03:55 -0000 1.50 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2006 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.49 2008/02/22 09:33:45 hollow Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/webapp.eclass,v 1.50 2008/02/22 10:03:55 hollow Exp $ |
27 |
# |
28 |
# @ECLASS: webapp.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -43,7 +43,6 @@ |
31 |
} |
32 |
|
33 |
# Check whether a specified file exists in the given directory (`.' by default) |
34 |
-# or not. |
35 |
webapp_checkfileexists() { |
36 |
local my_prefix |
37 |
|
38 |
@@ -75,6 +74,43 @@ |
39 |
echo "${1}" | sed -e 's|/./|/|g;' |
40 |
} |
41 |
|
42 |
+webapp_getinstalltype() { |
43 |
+ # or are we upgrading? |
44 |
+ |
45 |
+ if ! use vhosts ; then |
46 |
+ # we only run webapp-config if vhosts USE flag is not set |
47 |
+ |
48 |
+ local my_output |
49 |
+ |
50 |
+ my_output="$(webapp_check_installedat)" |
51 |
+ |
52 |
+ if [ "${?}" = "0" ] ; then |
53 |
+ # something is already installed there |
54 |
+ # |
55 |
+ # make sure it isn't the same version |
56 |
+ |
57 |
+ local my_pn="$(echo ${my_output} | awk '{ print $1 }')" |
58 |
+ local my_pvr="$(echo ${my_output} | awk '{ print $2 }')" |
59 |
+ |
60 |
+ REMOVE_PKG="${my_pn}-${my_pvr}" |
61 |
+ |
62 |
+ if [ "${my_pn}" == "${PN}" ]; then |
63 |
+ if [ "${my_pvr}" != "${PVR}" ]; then |
64 |
+ elog "This is an upgrade" |
65 |
+ IS_UPGRADE=1 |
66 |
+ else |
67 |
+ elog "This is a re-installation" |
68 |
+ IS_REPLACE=1 |
69 |
+ fi |
70 |
+ else |
71 |
+ elog "${my_output} is installed there" |
72 |
+ fi |
73 |
+ else |
74 |
+ elog "This is an installation" |
75 |
+ fi |
76 |
+ fi |
77 |
+} |
78 |
+ |
79 |
# ============================================================================== |
80 |
# PUBLIC FUNCTIONS |
81 |
# ============================================================================== |
82 |
@@ -232,15 +268,32 @@ |
83 |
fi |
84 |
} |
85 |
|
86 |
+# @FUNCTION: webapp_src_preinst |
87 |
+# @DESCRIPTION: |
88 |
+# You need to call this function in src_install() BEFORE anything else has run. |
89 |
+# For now we just create required webapp-config directories. |
90 |
+webapp_src_preinst() { |
91 |
+ dodir "${MY_HTDOCSDIR}" |
92 |
+ dodir "${MY_HOSTROOTDIR}" |
93 |
+ dodir "${MY_CGIBINDIR}" |
94 |
+ dodir "${MY_ICONSDIR}" |
95 |
+ dodir "${MY_ERRORSDIR}" |
96 |
+ dodir "${MY_SQLSCRIPTSDIR}" |
97 |
+ dodir "${MY_HOOKSCRIPTSDIR}" |
98 |
+ dodir "${MY_SERVERCONFIGDIR}" |
99 |
+} |
100 |
+ |
101 |
# ============================================================================== |
102 |
# EXPORTED FUNCTIONS |
103 |
# ============================================================================== |
104 |
|
105 |
# @FUNCTION: webapp_src_install |
106 |
# @DESCRIPTION: |
107 |
-# You need to call this function in src_install() AFTER everything else has run. |
108 |
-# For now, we just make sure that root owns everything, and that there are no |
109 |
-# setuid files. |
110 |
+# This is the default src_install(). For now, we just make sure that root owns |
111 |
+# everything, and that there are no setuid files. |
112 |
+# |
113 |
+# You need to call this function AFTER everything else has run in your custom |
114 |
+# src_install(). |
115 |
webapp_src_install() { |
116 |
chown -R "${VHOST_DEFAULT_UID}:${VHOST_DEFAULT_GID}" "${D}/" |
117 |
chmod -R u-s "${D}/" |
118 |
@@ -262,8 +315,12 @@ |
119 |
|
120 |
# @FUNCTION: webapp_pkg_setup |
121 |
# @DESCRIPTION: |
122 |
-# You need to call this function in pkg_config() AFTER everything else has run. |
123 |
-# If 'vhosts' USE flag is not set, auto-install this app. |
124 |
+# The default pkg_setup() for this eclass. This will gather required variables |
125 |
+# from webapp-config and check if there is an application installed to |
126 |
+# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. |
127 |
+# |
128 |
+# You need to call this function BEFORE anything else has run in your custom |
129 |
+# pkg_setup(). |
130 |
webapp_pkg_setup() { |
131 |
# add sanity checks here |
132 |
|
133 |
@@ -305,56 +362,14 @@ |
134 |
fi |
135 |
} |
136 |
|
137 |
-webapp_getinstalltype() { |
138 |
- # or are we upgrading? |
139 |
- |
140 |
- if ! use vhosts ; then |
141 |
- # we only run webapp-config if vhosts USE flag is not set |
142 |
- |
143 |
- local my_output |
144 |
- |
145 |
- my_output="$(webapp_check_installedat)" |
146 |
- |
147 |
- if [ "${?}" = "0" ] ; then |
148 |
- # something is already installed there |
149 |
- # |
150 |
- # make sure it isn't the same version |
151 |
- |
152 |
- local my_pn="$(echo ${my_output} | awk '{ print $1 }')" |
153 |
- local my_pvr="$(echo ${my_output} | awk '{ print $2 }')" |
154 |
- |
155 |
- REMOVE_PKG="${my_pn}-${my_pvr}" |
156 |
- |
157 |
- if [ "${my_pn}" == "${PN}" ]; then |
158 |
- if [ "${my_pvr}" != "${PVR}" ]; then |
159 |
- elog "This is an upgrade" |
160 |
- IS_UPGRADE=1 |
161 |
- else |
162 |
- elog "This is a re-installation" |
163 |
- IS_REPLACE=1 |
164 |
- fi |
165 |
- else |
166 |
- elog "${my_output} is installed there" |
167 |
- fi |
168 |
- else |
169 |
- elog "This is an installation" |
170 |
- fi |
171 |
- fi |
172 |
-} |
173 |
- |
174 |
-webapp_src_preinst() { |
175 |
- # create the directories that we need |
176 |
- |
177 |
- dodir "${MY_HTDOCSDIR}" |
178 |
- dodir "${MY_HOSTROOTDIR}" |
179 |
- dodir "${MY_CGIBINDIR}" |
180 |
- dodir "${MY_ICONSDIR}" |
181 |
- dodir "${MY_ERRORSDIR}" |
182 |
- dodir "${MY_SQLSCRIPTSDIR}" |
183 |
- dodir "${MY_HOOKSCRIPTSDIR}" |
184 |
- dodir "${MY_SERVERCONFIGDIR}" |
185 |
-} |
186 |
- |
187 |
+# @FUNCTION: webapp_pkg_postinst |
188 |
+# @DESCRIPTION: |
189 |
+# The default pkg_postinst() for this eclass. This installs the web application to |
190 |
+# `${ROOT}/var/www/localhost/htdocs/${PN}/' if USE=vhosts is not set. Otherwise |
191 |
+# display a short notice how to install this application with webapp-config. |
192 |
+# |
193 |
+# You need to call this function AFTER everything else has run in your custom |
194 |
+# pkg_postinst(). |
195 |
webapp_pkg_postinst() { |
196 |
webapp_read_config |
197 |
|
198 |
@@ -425,6 +440,11 @@ |
199 |
return 0 |
200 |
} |
201 |
|
202 |
+# @FUNCTION: webapp_pkg_prerm |
203 |
+# @DESCRIPTION: |
204 |
+# This is the default pkg_prerm() for this eclass. If USE=vhosts is not set |
205 |
+# remove all installed copies of this web application. Otherwise instruct the |
206 |
+# user to manually remove those copies. |
207 |
webapp_pkg_prerm() { |
208 |
# remove any virtual installs that there are |
209 |
|
210 |
|
211 |
|
212 |
|
213 |
-- |
214 |
gentoo-commits@l.g.o mailing list |