1 %define jsdkversion 20000924
2 %define apxs /usr/sbin/apxs
4 Summary: Servlet engine with support for the leading web server
5 Summary(pl): Silnik serwletów ze wsparciem dla wiod±cego serwera WWW
9 License: freely distributable & usable (JServ), LGPL (JSDK)
10 Group: Networking/Daemons
11 Source0: http://java.apache.org/jserv/dist/%{name}-%{version}.tar.gz
12 # Source0-md5: 6d48a1b9fcc5eea4dfebaae29ba5a485
13 Source1: http://www.euronet.nl/~pauls/java/servlet/download/classpathx_servlet-%{jsdkversion}.tar.gz
14 # Source1-md5: a81feddb91b1358f9aaed94e83eddb54
15 Patch0: %{name}-enable-secret.patch
16 URL: http://java.apache.org/
17 BuildRequires: apache-devel >= 1.3.9-8
21 Requires(post,preun): fileutils
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)
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
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/>
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/>
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
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
72 %{__make} -C classpathx_servlet-%{jsdkversion} jar_2_0
73 %{__make} -C classpathx_servlet-%{jsdkversion}/apidoc
77 cp classpathx_servlet-%{jsdkversion}/README \
78 classpathx_servlet-%{jsdkversion}/AUTHORS \
79 classpathx_servlet-%{jsdkversion}/COPYING.LIB \
81 cp -r classpathx_servlet-%{jsdkversion}/apidoc jsdk-doc
85 APXS_CFLAGS=`%{apxs} -q CFLAGS`
86 CFLAGS="$APXS_CFLAGS %{rpmcflags}" ./configure \
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
97 rm -rf $RPM_BUILD_ROOT
98 install -d $RPM_BUILD_ROOT%{classesdir}
99 #install -d $RPM_BUILD_ROOT/etc/{rc.d/init.d,profile.d,logrotate.d}
102 DESTDIR=$RPM_BUILD_ROOT
104 echo "default - change on install `date`" > $RPM_BUILD_ROOT%{jservconf}/jserv.secret.key
105 chmod 600 $RPM_BUILD_ROOT%{jservconf}/jserv.secret.key
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
113 install classpathx_servlet-%{jsdkversion}/servlet-2.0.jar $RPM_BUILD_ROOT%{classesdir}
115 find docs jsdk-doc -name 'Makefile*' | xargs rm -f
116 rm -rf jsdk-doc/{COPYING.LIB,CVS}
119 rm -rf $RPM_BUILD_ROOT
122 # use fortune + install-date + process-list to create pseudo-random, hardly
123 # guessable secret key. Use md5sum to create a hash from this, if available:
124 (fortune 2>/dev/null ; date ; ps -eal 2>/dev/null) \
125 | (md5sum 2>/dev/null || cat) > %{jservconf}/jserv.secret.key
126 chmod 600 %{jservconf}/jserv.secret.key
129 # determine apache-USER and chown the jserv.secrect.key - file
131 APACHEUSER=`grep "^User[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
132 if test ! "x$APACHEUSER" = x ; then
133 USERCOMMENT="(which is '$APACHEUSER' ?)"
138 chown $APACHEUSER %{jservconf}/jserv.secret.key
141 # determine apache-GROUP and allow this group to write to %{logdir}
142 APACHEGROUP=`grep "^Group[ ]\+" %{httpdconf}/httpd.conf | awk '{print $2}'`
143 if test "x$APACHEGROUP" = x ; then
146 chgrp $APACHEGROUP %{logdir}
150 # Add 'jserv' as an independent service (manual mode)
151 #/sbin/chkconfig --add jserv
152 #/etc/rc.d/init.d/jserv start
155 # Find Include Statement or add it if necessary
158 cp -f %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
159 grep -q '#\?.*[iI]nclude.*/jserv.conf' %{httpdconf}/httpd.conf
160 if test $? -eq 0 ; then
161 # found. Insert our include statement here
162 ## this depends on GNU-sed ('|')
163 sed 's|^#\?\(.*Include\).*/jserv.conf.*$|\1 %{jservconf}/jserv.conf|g' \
164 %{httpdconf}/httpd.conf.rpmorig > %{httpdconf}/httpd.conf
168 echo "<IfModule mod_jserv.c>"
169 echo " Include %{jservconf}/jserv.conf"
171 ) >> %{httpdconf}/httpd.conf
175 # LoadModule; uncomment or insert
177 grep -q '#\?.*LoadModule.*jserv_module.*mod_jserv.so' %{httpdconf}/httpd.conf
178 if test $? -eq 0 ; then
179 # found. Remove any comment
180 sed 's|^#.*\(LoadModule.*mod_jserv.so\)|\1|g' \
181 %{httpdconf}/httpd.conf > %{httpdconf}/httpd.conf.loadMod
182 mv -f %{httpdconf}/httpd.conf.loadMod %{httpdconf}/httpd.conf
184 # Insert LoadModule line before first valid LoadModule
188 echo "LoadModule jserv_module modules/mod_jserv.so"
191 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
195 # AddModule; uncomment or insert
197 grep -q '#\?.*AddModule.*mod_jserv.c' %{httpdconf}/httpd.conf
198 if test $? -eq 0 ; then
199 # found. Remove any comment
200 sed 's|^#.*\(AddModule.*mod_jserv.c\)|\1|g' \
201 %{httpdconf}/httpd.conf > %{httpdconf}/httpd.conf.addMod
202 mv -f %{httpdconf}/httpd.conf.addMod %{httpdconf}/httpd.conf
207 echo "AddModule mod_jserv.c"
210 ) | ed %{httpdconf}/httpd.conf > /dev/null 2>&1
214 # Search for JAVA at possible locations and edit wrapper.bin
217 for lookfor in java jre ; do
225 if test -x "$loc/bin/$lookfor" ; then
226 JAVABIN="$loc/bin/$lookfor"
231 if test -z "$JAVABIN" ; then
232 for prefix in /usr/jdk /usr/jdk- /usr/local/jdk /usr/local/jdk- ; do
233 for jplatform in 2 1 ; do
234 for subvers in .9 .8 .7 .6 .5 .4 .3 .2 .1 "" ; do
235 if test -x "${prefix}1.$jplatform$subvers/bin/$lookfor" ; then
236 JAVABIN="${prefix}1.$jplatform$subvers/bin/$lookfor"
240 if test ! -z "$JAVABIN" ; then break ; fi
242 if test ! -z "$JAVABIN" ; then break ; fi
245 if test ! -z "$JAVABIN" ; then break ; fi
249 if test ! -z "$JAVABIN" ; then
250 sed "s|^wrapper.bin=.*$|wrapper.bin=$JAVABIN|" \
251 %{jservconf}/jserv.properties > %{jservconf}/jserv.properties.new
252 mv -f %{jservconf}/jserv.properties.new %{jservconf}/jserv.properties
256 # Get Server Port to echo right URL below
258 SERVERPORT=`grep "^Port" %{httpdconf}/httpd.conf | \
259 head -n 1 | awk '{print ":" $2}'`
260 if test "$SERVERPORT" = ":80" ; then
264 #FIXME: make this i18n-aware
266 if test ! "x$JAVABIN" = x ; then
267 echo "using java VM $JAVABIN"
269 echo "## didn't find java or jre. Please install it and edit the"
270 echo "## wrapper.bin property in %{jservconf}/jserv.properties"
273 echo "In order to enable JServ, restart the webserver and try"
274 echo " http://localhost$SERVERPORT/servlets/IsItWorking"
276 echo " http://localhost$SERVERPORT/jserv/"
280 ## we hopefully may distribute SUN-jsdk.jar with jserv once ..
281 echo " | NOTE that this distribution contains a fully functional"
282 echo " | free jsdk replacement, see <http://www.euronet.nl/~pauls/java/servlet/>."
283 echo " | If you want to use the SUN-jsdk, replace the servlet-2.0.jar"
284 echo " | in the wrapper.classpath - line in the file"
285 echo " | %{jservconf}/jserv.properties"
286 echo " | with the SUN jsdk."
287 echo " | Get it from <http://java.sun.com/products/servlet/>."
288 echo " | Only JSDK 2.0 (Java Servlet Development Kit)"
289 echo " | is supported (_EXACTLY_ 2.0)."
292 echo "Please send comments/suggestions regarding"
293 echo "this RPM to <zeller@to.com>."
296 # do not remove the configured stuff if we upgrade.
297 # the $1 argument contains the number of packages _after_ installation.
298 if [ "$1" != "0" ] ; then
302 # Remove 'jserv' service (manual mode)
303 #/etc/rc.d/init.d/jserv stop
304 #/sbin/chkconfig --del jserv
307 # Find jserv related configuration settings and comment
311 cp -f %{httpdconf}/httpd.conf %{httpdconf}/httpd.conf.rpmorig
312 sed 's|.*\(Include.*%{jservconf}/jserv.conf\)|#\1|g' \
313 %{httpdconf}/httpd.conf.rpmorig \
314 | sed 's|^\(AddModule.*mod_jserv.c\)|#\1|g' \
315 | sed 's|^\(LoadModule.*mod_jserv.so\)|#\1|g' \
316 > %{httpdconf}/httpd.conf
318 /bin/rm -fr %{logdir}/mod_jserv.log
319 /bin/rm -fr %{logdir}/jserv.log
322 %defattr(644,root,root,755)
323 # mmh, we can't give %{_prefix}/docs to %doc ..
324 %doc index.html LICENSE README docs jsdk-doc
327 %config(noreplace) %verify(not size mtime md5) %{jservconf}/jserv.properties
328 %config(noreplace) %verify(not size mtime md5) %{jservconf}/zone.properties
329 %config(noreplace) %verify(not size mtime md5) %{jservconf}/jserv.conf
331 # these are just for demonstration and thus,
332 # no %config-files per-se; do not install
333 # them for the RPM-packet
334 #%%{jservconf}/jserv.properties.default
335 #%%{jservconf}/zone.properties.default
336 #%%{jservconf}/jserv.conf.default
338 %attr(600,http,http) %{jservconf}/jserv.secret.key
339 #%config /etc/rc.d/init.d/jserv
340 #%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) /etc/logrotate.d/jserv
341 #%config /etc/profile.d/jserv.sh
343 %attr(755,root,root) %{libexecdir}/mod_jserv.so
344 %{libexecdir}/ApacheJServ.jar
347 %{classesdir}/servlet-2.0.jar
350 %{servletdir}/Hello.java
351 %{servletdir}/Hello.class
352 %{servletdir}/IsItWorking.java
353 %{servletdir}/IsItWorking.class
355 # we need to have write access here
356 %attr(770,root,http) %dir %{logdir}