]> git.pld-linux.org Git - packages/ApacheJServ.git/blob - ApacheJServ.spec
- massive attack: adding Source-md5
[packages/ApacheJServ.git] / ApacheJServ.spec
1 %define         jsdkversion     20000924
2 %define         apxs            /usr/sbin/apxs
3
4 Summary:        Servlet engine with support for the leading web server
5 Summary(pl):    Silnik serwletów ze wsparciem dla wiod±cego serwera WWW
6 Name:           ApacheJServ
7 Version:        1.1.2
8 Release:        1
9 Source0:        http://java.apache.org/jserv/dist/%{name}-%{version}.tar.gz
10 # Source0-md5:  6d48a1b9fcc5eea4dfebaae29ba5a485
11 Source1:        http://www.euronet.nl/~pauls/java/servlet/download/classpathx_servlet-%{jsdkversion}.tar.gz
12 # Source1-md5:  a81feddb91b1358f9aaed94e83eddb54
13 Patch0:         %{name}-enable-secret.patch
14 URL:            http://java.apache.org/
15 License:        freely distributable & usable (JServ), LGPL (JSDK)
16 Group:          Networking/Daemons
17 BuildRequires:  apache-devel >= 1.3.9-8
18 BuildRequires:  jdk
19 Requires(post): awk
20 Requires(post): ed
21 Requires(post,preun):   fileutils
22 Requires(post): grep
23 Requires(post,preun):   sed
24 Requires(post): sh-utils
25 Requires(post): textutils
26 Requires:       apache >= 1.3.6
27 Provides:       jserv jsdk20
28 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
29
30 %define         libexecdir      %(%{apxs} -q LIBEXECDIR)
31 %define         httpdconf       %(%{apxs} -q SYSCONFDIR)
32 %define         jservconf       %{httpdconf}/jserv
33 %define         logdir          /var/log/httpd
34 %define         servletdir      /home/services/httpd/servlets
35 %define         classesdir      /home/services/httpd/classes
36
37 %description
38 Apache JServ is a servlet engine, developed by the Java Apache Project
39 <http://java.apache.org/>. The Apache JServ servlet engine is written
40 in 100pc Java application, and listens for servlet requests using the
41 Apache Java protocol (AJp). Typically, these requests will originate
42 from the mod_jserv Apache module (DSO included). This package contains
43 a LGPL'ed implementation of sun's java servlet api version 2.0 by Paul
44 Siegmann <http://www.euronet.nl/~pauls/java/servlet/>
45
46 %description -l pl
47 Apache JServ jest silnikiem serwletowym, rozwijanym przez Java Apache
48 Project <http://java.apache.org/>. Silnik serwletowy Apache JServ
49 zosta³ napisany od pocz±tku do koñca w Javie; nas³uchuje wywo³añ
50 serwletu wykorzystuj±c protokó³ Apache Java (AJp). Zazwyczaj wywo³ania
51 te pochodz± z modu³u Apache mod_jservmodule (³±cznie z DSO). Pakiet
52 ten zawiera sunowsk± implementacjê api serletów w javie w wersji 2.0
53 (na licencji LGPL) napisana przez Paula Siegmanna
54 <http://www.euronet.nl/~pauls/java/servlet/>
55
56 %prep
57 %setup -q -a1
58 %patch0 -p0
59
60 # final position of GNU JSDK-Classes
61 sed 's|@JSDK_CLASSES@|%{classesdir}/servlet-2.0.jar|g' \
62         conf/jserv.properties.in  > conf/jserv.properties.in.new
63 mv -f conf/jserv.properties.in.new conf/jserv.properties.in
64
65 # do not load module in provided jserv.conf; we do this in httpd.conf
66 sed 's|@LOAD_OR_NOT@|#|g' conf/jserv.conf.in  \
67         > conf/jserv.conf.in.new
68 mv -f conf/jserv.conf.in.new conf/jserv.conf.in
69
70 %build
71 # prepare compilation
72 %{__make} -C classpathx_servlet-%{jsdkversion} jar_2_0
73 %{__make} -C classpathx_servlet-%{jsdkversion}/apidoc
74
75 # copy API-doc
76 mkdir jsdk-doc
77 cp classpathx_servlet-%{jsdkversion}/README \
78         classpathx_servlet-%{jsdkversion}/AUTHORS \
79         classpathx_servlet-%{jsdkversion}/COPYING.LIB \
80         jsdk-doc
81 cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
82
83 ### JSERV
84
85 APXS_CFLAGS=`%{apxs} -q CFLAGS`
86 CFLAGS="$APXS_CFLAGS %{rpmcflags}" ./configure \
87         --prefix=%{_prefix} \
88         --disable-debugging \
89         --with-apxs=%{apxs} \
90         --with-logdir=%{logdir} \
91         --with-servlets=%{servletdir} \
92         --with-JSDK=`pwd`/classpathx_servlet-%{jsdkversion}/servlet-2.0.jar \
93         --with-jdk-home=/usr/lib/java
94 %{__make}
95
96 %install
97 rm -rf $RPM_BUILD_ROOT
98
99 %{__make} DESTDIR=$RPM_BUILD_ROOT install
100
101 echo "default - change on install `date`" > $RPM_BUILD_ROOT%{jservconf}/jserv.secret.key
102 chmod 600 $RPM_BUILD_ROOT%{jservconf}/jserv.secret.key
103
104 # currently disabled
105 #install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
106 #install -d $RPM_BUILD_ROOT/etc/profile.d
107 #install -d $RPM_BUILD_ROOT/etc/logrotate.d
108 #install -m755 src/scripts/package/rpm/jserv.init      $RPM_BUILD_ROOT/etc/rc.d/init.d/jserv
109 #install -m755 src/scripts/package/rpm/jserv.sh        $RPM_BUILD_ROOT/etc/profile.d
110 #install -m644 src/scripts/package/rpm/jserv.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/jserv
111
112 ### GNU JSDK-classes
113 install -d $RPM_BUILD_ROOT%{classesdir}
114 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar $RPM_BUILD_ROOT%{classesdir}
115
116 find docs jsdk-doc -name 'Makefile*' | xargs rm -f
117 rm -rf jsdk-doc/{COPYING.LIB,CVS}
118
119 %clean
120 rm -rf $RPM_BUILD_ROOT
121
122 %post
123 # use fortune + install-date + process-list to create pseudo-random, hardly
124 # guessable secret key. Use md5sum to create a hash from this, if available:
125 (fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
126         | (md5sum 2>/dev/null || cat) > %{jservconf}/jserv.secret.key
127 chmod 600 %{jservconf}/jserv.secret.key
128
129 #
130 # determine apache-USER and chown the jserv.secrect.key - file
131 #
132 APACHEUSER=`grep "^User[         ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
133 if test ! "x$APACHEUSER" = x ; then
134         USERCOMMENT="(which is '$APACHEUSER' ?)"
135 else
136 # assumption:
137         APACHEUSER=http
138 fi
139 chown $APACHEUSER %{jservconf}/jserv.secret.key
140
141 #
142 # determine apache-GROUP and allow this group to write to %{logdir}
143 APACHEGROUP=`grep "^Group[       ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
144 if test "x$APACHEGROUP" = x ; then
145         APACHEGROUP=http
146 fi
147 chgrp $APACHEGROUP %{logdir}
148 chmod g+w %{logdir}
149
150 #
151 # Add 'jserv' as an independent service (manual mode)
152 #/sbin/chkconfig --add jserv
153 #/etc/rc.d/init.d/jserv start
154
155 #
156 # Find Include Statement or add it if necessary
157 #
158 umask 027
159 cp -f %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
160 grep -q '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf
161 if test $? -eq 0 ; then
162     # found. Insert our include statement here
163     ## this depends on GNU-sed ('|')
164     sed 's|^#\?\(.*Include\).*/jserv.conf.*$|\1 %{jservconf}/jserv.conf|g' \
165         %{httpdconf}/httpd.conf.rpmorig > %{httpdconf}/httpd.conf
166 else
167     # append it
168     (
169         echo "<IfModule mod_jserv.c>"
170         echo "       Include %{jservconf}/jserv.conf"
171         echo "</IfModule>"
172     ) >> %{httpdconf}/httpd.conf
173 fi
174
175 #
176 # LoadModule; uncomment or insert
177 #
178 grep -q '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf
179 if test $? -eq 0 ; then
180     # found. Remove any comment
181     sed 's|^#.*\(LoadModule.*mod_jserv.so\)|\1|g' \
182         %{httpdconf}/httpd.conf > %{httpdconf}/httpd.conf.loadMod
183     mv -f %{httpdconf}/httpd.conf.loadMod %{httpdconf}/httpd.conf
184 else
185     # Insert LoadModule line before first valid LoadModule
186     (
187         echo "/^LoadModule"
188         echo "i"
189         echo "LoadModule jserv_module   modules/mod_jserv.so"
190         echo "."
191         echo "wq"
192     ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
193 fi
194
195 #
196 # AddModule; uncomment or insert
197 #
198 grep -q '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf
199 if test $? -eq 0  ; then
200     # found. Remove any comment
201     sed 's|^#.*\(AddModule.*mod_jserv.c\)|\1|g' \
202         %{httpdconf}/httpd.conf > %{httpdconf}/httpd.conf.addMod
203     mv -f %{httpdconf}/httpd.conf.addMod %{httpdconf}/httpd.conf
204 else
205     (
206         echo "/^AddModule"
207         echo "i"
208         echo "AddModule mod_jserv.c"
209         echo "."
210         echo "wq"
211     ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
212 fi
213
214 #
215 # Search for JAVA at possible locations and edit wrapper.bin
216 #
217 unset JAVABIN
218 for lookfor in java jre ; do
219     for loc in \
220         $JAVA_HOME \
221         $JDK_HOME \
222         /usr/lib/java \
223         /usr/local/java* \
224         /usr/local/jdk*
225     do
226         if test -x "$loc/bin/$lookfor" ; then
227             JAVABIN="$loc/bin/$lookfor"
228             break
229         fi
230     done
231
232     if test -z "$JAVABIN" ; then
233         for prefix in /usr/jdk /usr/jdk- /usr/local/jdk /usr/local/jdk- ; do
234             for jplatform in 2 1 ; do
235                 for subvers in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
236                     if test -x "${prefix}1.$jplatform$subvers/bin/$lookfor" ; then
237                         JAVABIN="${prefix}1.$jplatform$subvers/bin/$lookfor"
238                         break
239                     fi
240                 done
241                 if test ! -z "$JAVABIN" ; then break ; fi
242             done
243             if test ! -z "$JAVABIN" ; then break ; fi
244         done
245     fi
246     if test ! -z "$JAVABIN" ; then break ; fi
247 done
248
249 umask 022
250 if test ! -z "$JAVABIN" ; then
251     sed "s|^wrapper.bin=.*$|wrapper.bin=$JAVABIN|" \
252         %{jservconf}/jserv.properties > %{jservconf}/jserv.properties.new
253     mv -f %{jservconf}/jserv.properties.new %{jservconf}/jserv.properties
254 fi
255
256 #
257 # Get Server Port to echo right URL below
258 #
259 SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
260                         head -1 | awk '{print ":" $2}'`
261 if test "$SERVERPORT" = ":80" ; then
262         SERVERPORT=""
263 fi
264
265 #FIXME:         make this i18n-aware
266
267 if test ! "x$JAVABIN" = x ; then
268     echo "using java VM $JAVABIN"
269 else
270     echo "## didn't find java or jre. Please install it and edit the"
271     echo "## wrapper.bin property in %{jservconf}/jserv.properties"
272 fi
273 echo ""
274 echo "In order to enable JServ, restart the webserver and try"
275 echo "           http://localhost$SERVERPORT/servlets/IsItWorking"
276 echo "   and"
277 echo "           http://localhost$SERVERPORT/jserv/"
278 echo "-- ENJOY! --"
279 echo ""
280
281 ## we hopefully may distribute SUN-jsdk.jar with jserv once ..
282 echo " | NOTE that this distribution contains a fully functional"
283 echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
284 echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
285 echo " | in the wrapper.classpath - line in the file"
286 echo " |                 %{jservconf}/jserv.properties"
287 echo " | with the SUN jsdk."
288 echo " | Get it from <http://java.sun.com/products/servlet/>."
289 echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
290 echo " | is supported (_EXACTLY_ 2.0)."
291 echo ""
292
293 echo "Please send comments/suggestions regarding"
294 echo "this RPM to <zeller@to.com>."
295
296 %preun
297 # do not remove the configured stuff if we upgrade.
298 # the $1 argument contains the number of packages _after_ installation.
299 if [ "$1" != "0" ] ; then
300     exit 0
301 fi
302
303 # Remove 'jserv' service (manual mode)
304 #/etc/rc.d/init.d/jserv stop
305 #/sbin/chkconfig --del jserv
306
307 #
308 # Find jserv related configuration settings and comment
309 # them out
310 #
311 umask 027
312 cp -f %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
313 sed 's|.*\(Include.*%{jservconf}/jserv.conf\)|#\1|g' \
314     %{httpdconf}/httpd.conf.rpmorig \
315     | sed 's|^\(AddModule.*mod_jserv.c\)|#\1|g' \
316     | sed 's|^\(LoadModule.*mod_jserv.so\)|#\1|g' \
317     > %{httpdconf}/httpd.conf
318 # remove old logs
319 /bin/rm -fr %{logdir}/mod_jserv.log
320 /bin/rm -fr %{logdir}/jserv.log
321
322 %files
323 %defattr(644,root,root,755)
324 # mmh, we can't give %{_prefix}/docs to %doc ..
325 %doc index.html LICENSE README docs jsdk-doc
326
327 %dir %{jservconf}
328 %config(noreplace) %verify(not size mtime md5) %{jservconf}/jserv.properties
329 %config(noreplace) %verify(not size mtime md5) %{jservconf}/zone.properties
330 %config(noreplace) %verify(not size mtime md5) %{jservconf}/jserv.conf
331
332 # these are just for demonstration and thus,
333 # no %config-files per-se; do not install
334 # them for the RPM-packet
335 #%%{jservconf}/jserv.properties.default
336 #%%{jservconf}/zone.properties.default
337 #%%{jservconf}/jserv.conf.default
338
339 %attr(600,http,http) %{jservconf}/jserv.secret.key
340 #%config /etc/rc.d/init.d/jserv
341 #%config /etc/logrotate.d/jserv
342 #%config /etc/profile.d/jserv.sh
343
344 %attr(755,root,root) %{libexecdir}/mod_jserv.so
345 %{libexecdir}/ApacheJServ.jar
346
347 %dir %{classesdir}
348 %{classesdir}/servlet-2.0.jar
349
350 %dir %{servletdir}
351 %{servletdir}/Hello.java
352 %{servletdir}/Hello.class
353 %{servletdir}/IsItWorking.java
354 %{servletdir}/IsItWorking.class
355
356 # we need to have write access here
357 %attr(770,root,http) %dir %{logdir}
This page took 0.127432 seconds and 4 git commands to generate.