OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   07-Dec-2004 17:04:02
  Branch: HEAD                             Handle: 2004120716040100

  Modified files:
    openpkg-src/jboss       jboss.sh jboss.spec rc.jboss

  Log:
    switch from susr to nusr under run-time; use connection checking
    instead of logfile checking; introduce with_compat option for vendor
    compatible filesystem layout

  Summary:
    Revision    Changes     Path
    1.2         +4  -0      openpkg-src/jboss/jboss.sh
    1.3         +37 -7      openpkg-src/jboss/jboss.spec
    1.3         +40 -24     openpkg-src/jboss/rc.jboss
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/jboss/jboss.sh
  ============================================================================
  $ cvs diff -u -r1.1 -r1.2 jboss.sh
  --- openpkg-src/jboss/jboss.sh        19 Nov 2004 20:14:56 -0000      1.1
  +++ openpkg-src/jboss/jboss.sh        7 Dec 2004 16:04:01 -0000       1.2
  @@ -1,4 +1,8 @@
   ##
   ##  jboss.sh -- JBoss Shell Environment Script
   ##
  +##  Notice: This script will be executed just before JBoss starts.
  +##  If any site-specific run-time environment settings are necessary
  +##  for JBoss to work properly, place them here, please.
  +##
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/jboss/jboss.spec
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 jboss.spec
  --- openpkg-src/jboss/jboss.spec      25 Nov 2004 15:13:57 -0000      1.2
  +++ openpkg-src/jboss/jboss.spec      7 Dec 2004 16:04:01 -0000       1.3
  @@ -34,7 +34,10 @@
   Group:        Development
   License:      GPL
   Version:      3.2.6
  -Release:      20041125
  +Release:      20041207
  +
  +#   package options
  +%option       with_compat no
   
   #   list of sources
   Source0:      
http://osdn.dl.sourceforge.net/sourceforge/jboss/jboss-%{version}-src.tar.bz2
  @@ -45,7 +48,7 @@
   Prefix:       %{l_prefix}
   BuildRoot:    %{l_buildroot}
   BuildPreReq:  OpenPKG, openpkg >= 2.0.0, JDK, j2se14 >= 1.4.2, ant >= 1.5
  -PreReq:       OpenPKG, openpkg >= 2.0.0, JDK, j2se14 >= 1.4.2
  +PreReq:       OpenPKG, openpkg >= 2.0.0, JDK, j2se14 >= 1.4.2, netcat
   AutoReq:      no
   AutoReqProv:  no
   
  @@ -77,7 +80,6 @@
           $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
           $RPM_BUILD_ROOT%{l_prefix}/etc/jboss \
           $RPM_BUILD_ROOT%{l_prefix}/libexec/jboss \
  -        $RPM_BUILD_ROOT%{l_prefix}/var/jboss/tmp \
           $RPM_BUILD_ROOT%{l_prefix}/var/jboss/server
   
       #   copy whole hierarchy to libexec
  @@ -89,12 +91,14 @@
       cp -r \
           $RPM_BUILD_ROOT%{l_prefix}/libexec/jboss/server/default/* \
           $RPM_BUILD_ROOT%{l_prefix}/var/jboss/server/
  +%if "%{with_compat}" == "no"
       mv  $RPM_BUILD_ROOT%{l_prefix}/var/jboss/server/conf/* \
           $RPM_BUILD_ROOT%{l_prefix}/etc/jboss/
       rmdir \
           $RPM_BUILD_ROOT%{l_prefix}/var/jboss/server/conf
       ln -s %{l_prefix}/etc/jboss \
           $RPM_BUILD_ROOT%{l_prefix}/var/jboss/server/conf
  +%endif
   
       #   install rc script
       %{l_shtool} install -c -m 755 %{l_value -s -a} \
  @@ -107,8 +111,29 @@
       #   determine installation files
       %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
           %{l_files_std} \
  +        '%dir %attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/jboss/*/*/*/*/*/*/*/*' 
\
  +        '%attr(-,%{l_nusr},%{l_ngrp}) 
%{l_prefix}/var/jboss/*/*/*/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) 
%{l_prefix}/var/jboss/*/*/*/*/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) 
%{l_prefix}/var/jboss/*/*/*/*/*/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) 
%{l_prefix}/var/jboss/*/*/*/*/*/*/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) 
%{l_prefix}/var/jboss/*/*/*/*/*/*/*/*/*/*/*/*/*' \
  +        '%attr(-,%{l_nusr},%{l_ngrp}) 
%{l_prefix}/var/jboss/*/*/*/*/*/*/*/*/*/*/*/*/*/*' \
  +%if "%{with_compat}" == "no"
           '%config %{l_prefix}/etc/jboss/*' \
  -        '%config %{l_prefix}/etc/jboss/xmdesc/*'
  +        '%config %{l_prefix}/etc/jboss/*/*' \
  +%else
  +        '%config %{l_prefix}/var/jboss/server/conf/*' \
  +        '%config %{l_prefix}/var/jboss/server/conf/*/*' \
  +%endif
  +        '%config %{l_prefix}/var/jboss/server/deploy/*.xml'
   
   %files -f files
   
  @@ -118,11 +143,16 @@
   %post
       if [ $1 -eq 1 ]; then
           #   display final hint after initial installation
  -        ( echo "JBoss is successfully installed. After starting JBoss with"
  +        ( echo "JBoss is successfully installed and configured with its"
  +          echo "'default' configuration in"
  +          echo "    $RPM_INSTALL_PREFIX/var/jboss/server/"
  +          echo "After starting JBoss with"
             echo "    \$ $RPM_INSTALL_PREFIX/etc/rc jboss start"
  -          echo "and should connect to its Web interface under"
  +          echo "you may connect to its Web management interface under"
             echo "    http://127.0.0.1:8080/web-console";
  -          echo "further configure the JBoss application server."
  +          echo "in order to further configure the JBoss application server."
  +          echo "JBoss configuration files are located in the directory"
  +          echo "    $RPM_INSTALL_PREFIX/var/jboss/server/conf/"
           ) | %{l_rpmtool} msg -b -t notice
       fi
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/jboss/rc.jboss
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 rc.jboss
  --- openpkg-src/jboss/rc.jboss        25 Nov 2004 15:13:57 -0000      1.2
  +++ openpkg-src/jboss/rc.jboss        7 Dec 2004 16:04:01 -0000       1.3
  @@ -6,69 +6,85 @@
   %config
       jboss_enable="$openpkg_rc_def"
       jboss_config="server"
  +    jboss_console="/dev/null"
   
   %common
       jboss_bindir="@l_prefix@/libexec/jboss/bin"
  -    jboss_console="@l_prefix@/var/jboss/tmp/console.log"
  -    jboss_signal () {
  -        rpmtool signal \
  -            -m "-classpath @l_prefix@/libexec/jboss/bin/run.jar.* 
org.jboss.Main " $1
  +    jboss_check_host=127.0.0.1     # host to check whether it accepts 
connections
  +    jboss_check_port=1098          # port to check whether it accepts 
connections
  +    jboss_check_timeout_start=120  # max seconds until JBoss accepts 
connections on startup
  +    jboss_check_timeout_stop=40    # max seconds until JBoss rejects 
connections on shutdown
  +    jboss_probe () {
  +        #   check whether JBoss is up and running
  +        nc -z $jboss_check_host $jboss_check_port >/dev/null 2>&1
       }
       jboss_start () {
           export JAVA_HOME=$JDK_home
  +
           #   load custom environment
           . @l_prefix@/etc/jboss/jboss.sh
  -        #   set logfile size to zero length for startup test
  -        cp /dev/null $jboss_console
  +
           #   startup JBoss as a background process
           ( nohup $jboss_bindir/run.sh -c $jboss_config \
                 -D jboss.server.base.url=file:@l_prefix@/var/jboss \
                 -D [EMAIL PROTECTED]@/var/jboss \
                 </dev/null >$jboss_console 2>&1 &
           ) >/dev/null 2>&1
  -        #   wait for JBoss to be actually ready for service
  -        sleep 5
  -        test -s $jboss_console || rcMsg -e "JBoss does not start"
  +
  +        #   wait for JBoss until it accepts connections
           i=0
  -        while [ $i -lt 60 ]; do
  -            grep "Started in [0-9].*[0-9]ms$" $jboss_console >/dev/null && 
break
  -            sleep 5
  -            i=$(($i + 1))
  +        until jboss_probe; do
  +           i=$(($i + 1))
  +           [ $i -gt $jboss_check_timeout_start ] && \
  +                    rcMsg -e "JBoss does not start" && \
  +                    exit 1
  +           sleep 1
           done
  -        [ $i -eq 60 ] && exit 1; exit 0
  +        exit 0
       }
       jboss_stop () {
  +        #   FIXME: this is all but elegant but otherwise shutdown fails in 
3.2.6
  +        for f in `find @l_prefix@/libexec/jboss/client -name '*.jar'`; do
  +           JBOSS_CLASSPATH="$f:$JBOSS_CLASSPATH"
  +        done
  +        export JBOSS_CLASSPATH
  +
  +        #   trigger JBoss shutdown process
           export JAVA_HOME=$JDK_home
           $jboss_bindir/shutdown.sh -S
  +
  +        #   wait until JBoss service disappears
           i=0
  -        while [ $i -lt 60 ]; do
  -            grep "^Shutdown complete" $jboss_console >/dev/null && break
  -            sleep 3
  -            i=$(($i + 1))
  +        while jboss_probe; do
  +           i=$(($i + 1))
  +           [ $i -gt $jboss_check_timeout_stop ] && \
  +               rcMsg -e "failed to assure that JBoss has stopped"  && \
  +               exit 1
  +           sleep 1
           done
  -        [ $i -eq 60 ] && exit 1; exit 0
  +        exit 0
       }
   
  -%status -u @l_susr@ -o
  +%status -u @l_nusr@ -o
       jboss_usable="unknown"
       jboss_active="no"
       rcService jboss enable yes && \
  -        jboss_signal 0 && jboss_active="yes"
  +        jboss_probe && jboss_active="yes"
       echo "jboss_enable=\"$jboss_enable\""
       echo "jboss_usable=\"$jboss_usable\""
       echo "jboss_active=\"$jboss_active\""
   
  -%start -u @l_susr@
  +%start -u @l_nusr@
       rcService jboss enable yes || exit 0
       rcService jboss active yes && exit 0
       jboss_start
   
  -%stop -u @l_susr@
  +%stop -u @l_nusr@
       rcService jboss enable yes || exit 0
       rcService jboss active no  && exit 0
       jboss_stop
   
  -%restart -u @l_susr@
  +%restart -u @l_nusr@
       rcService jboss enable yes || exit 0
       rcService jboss active no  && exit 0
       rc jboss stop start
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to