瀏覽代碼

new package: avis 1.1.0 (Event Router)

Ralf S. Engelschall 18 年之前
父節點
當前提交
f54dbd6256
共有 2 個文件被更改,包括 217 次插入0 次删除
  1. 148 0
      avis/avis.spec
  2. 69 0
      avis/rc.avis

+ 148 - 0
avis/avis.spec

@@ -0,0 +1,148 @@
+##
+##  avis.spec -- OpenPKG RPM Package Specification
+##  Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
+##  Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
+##
+##  Permission to use, copy, modify, and distribute this software for
+##  any purpose with or without fee is hereby granted, provided that
+##  the above copyright notice and this permission notice appear in all
+##  copies.
+##
+##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
+##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+##  SUCH DAMAGE.
+##
+
+#   package versions
+%define       V_avis_server 1.1.0
+%define       V_avis_client 1.0.1
+
+#   package information
+Name:         avis
+Summary:      Event Router
+URL:          http://avis.sourceforge.net/
+Vendor:       Matthew Phillip
+Packager:     OpenPKG Foundation e.V.
+Distribution: OpenPKG Community
+Class:        EVAL
+Group:        InstantMessaging
+License:      GPL
+Version:      %{V_avis_server}
+Release:      20070827
+
+#   list of sources
+Source0:      http://switch.dl.sourceforge.net/avis/avis-src-%{V_avis_server}.zip
+Source1:      http://switch.dl.sourceforge.net/avis/avis-client-%{V_avis_client}.zip
+Source2:      rc.avis
+
+#   build information
+Prefix:       %{l_prefix}
+BuildRoot:    %{l_buildroot}
+BuildPreReq:  OpenPKG, openpkg >= 20060823
+PreReq:       OpenPKG, openpkg >= 20060823, java, JAVA-JDK
+AutoReq:      no
+AutoReqProv:  no
+
+%description
+    Avis is a multicast event bus. It provides a fast, publish/subscribe
+    event routing service compatible with the commercial Elvin
+    implementation developed by Mantara Software. Elvin routers can be
+    federated together to form wide-area event notification networks.
+    Clients can exchange events with other clients anywhere on the bus,
+    subscribing to messages using pattern-matching expressions that
+    select messages based on their content.
+
+%track
+    prog avis:server = {
+        version   = %{V_avis_server}
+        url       = http://prdownloads.sourceforge.net/avis/
+        regex     = avis-src-(__VER__)\.zip
+    }
+    prog avis:client = {
+        version   = %{V_avis_client}
+        url       = http://prdownloads.sourceforge.net/avis/
+        regex     = avis-client-(__VER__)\.zip
+    }
+
+%prep
+    %setup -q -T -c
+    %{l_prefix}/bin/unzip -q -x %{SOURCE0}
+    %{l_prefix}/bin/unzip -q -x %{SOURCE1}
+
+%build
+
+%install
+    #   create installation hierarchy
+    rm -rf $RPM_BUILD_ROOT
+    %{l_shtool} mkdir -f -p -m 755 \
+        $RPM_BUILD_ROOT%{l_prefix}/bin \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/avis \
+        $RPM_BUILD_ROOT%{l_prefix}/libexec/avis \
+        $RPM_BUILD_ROOT%{l_prefix}/var/avis
+
+    #   install Java program
+    %{l_shtool} install -c -m 644 \
+        avis-%{V_avis_server}/server/lib/avisd.jar \
+        avis-client-%{V_avis_client}/client/lib/avis-client.jar \
+        avis-client-%{V_avis_client}/client/lib/avis-tools.jar \
+        $RPM_BUILD_ROOT%{l_prefix}/libexec/avis/
+
+    #   install default server configuration
+    %{l_shtool} install -c -m 644 \
+        -e 's;# Listen=elvin://0\.0\.0\.0;Listen=elvin://127.0.0.1:2917;' \
+        avis-%{V_avis_server}/server/etc/avisd.config \
+        $RPM_BUILD_ROOT%{l_prefix}/etc/avis/avisd.config
+
+    #   install client wrapper scripts
+    ( echo "#!/bin/sh"
+      echo "exec %{l_prefix}/bin/java -Vsun-jdk -Xverify:none \\%{l_nil}"
+      echo "    -cp %{l_prefix}/libexec/avis/avis-tools.jar \\%{l_nil}"
+      echo "    org.avis.tools.Ec \${1+\"\$@\"}"
+    ) >ec
+    ( echo "#!/bin/sh"
+      echo "exec %{l_prefix}/bin/java -Vsun-jdk -Xverify:none \\%{l_nil}"
+      echo "    -cp %{l_prefix}/libexec/avis/avis-tools.jar \\%{l_nil}"
+      echo "    org.avis.tools.Ep \${1+\"\$@\"}"
+    ) >ep
+    %{l_shtool} install -c -m 755 \
+        ec ep $RPM_BUILD_ROOT%{l_prefix}/bin/
+
+    #   install run-command script
+    %{l_shtool} install -c -m 755 %{l_value -s -a} \
+        %{SOURCE rc.avis} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
+
+    #   determine installation files
+    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
+        %{l_files_std} \
+        '%config %{l_prefix}/etc/avis/avisd.config' \
+        '%dir %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/avis'
+
+%files -f files
+
+%clean
+    rm -rf $RPM_BUILD_ROOT
+
+%post
+    #   after upgrade, restart service
+    [ $1 -eq 2 ] || exit 0
+    eval `%{l_rc} avis status 2>/dev/null`
+    [ ".$avis_active" = .yes ] && %{l_rc} avis restart
+    exit 0
+
+%preun
+    #   before erase, stop service and remove log files
+    [ $1 -eq 0 ] || exit 0
+    %{l_rc} avis stop 2>/dev/null
+    rm -f $RPM_INSTALL_PREFIX/var/avis/avis.log* >/dev/null 2>&1 || true
+    exit 0
+

+ 69 - 0
avis/rc.avis

@@ -0,0 +1,69 @@
+#!@l_prefix@/bin/openpkg rc
+##
+##  rc.avis -- Run-Commands
+##
+
+%config
+    avis_enable="$openpkg_rc_def"
+    avis_flags=""
+    avis_flags_jvm="-Xms128M -Xmx256M -Xverify:none -XX:+UseParallelGC"
+    avis_log_prolog="true"
+    avis_log_epilog="true"
+    avis_log_numfiles="10"
+    avis_log_minsize="1M"
+    avis_log_complevel="9"
+
+%common
+    avis_cfgfile="@l_prefix@/etc/avis/avisd.config"
+    avis_pidfile="@l_prefix@/var/avis/avisd.pid"
+    avis_logfile="@l_prefix@/var/avis/avisd.log"
+    avis_jarfile="@l_prefix@/libexec/avis/avisd.jar"
+    avis_signal () {
+        [ -f $avis_pidfile ] && kill -$1 `cat $avis_pidfile`
+    }
+
+%status -u @l_rusr@ -o
+    avis_usable="unknown"
+    avis_active="no"
+    rcService avis enable yes && \
+        avis_signal 0 && avis_active="yes"
+    echo "avis_enable=\"$avis_enable\""
+    echo "avis_usable=\"$avis_usable\""
+    echo "avis_active=\"$avis_active\""
+
+%start -u @l_rusr@
+    rcService avis enable yes || exit 0
+    rcService avis active yes && exit 0
+    cmd="@l_prefix@/bin/java"
+    cmd="$cmd -server"
+    cmd="$cmd $avis_flags_jvm"
+    cmd="$cmd -jar $avis_jarfile"
+    cmd="$cmd -c $avis_cfgfile"
+    cmd="$cmd $avis_flags"
+    ( eval `JAVA_PLATFORM="sun-jdk" @l_prefix@/bin/java-toolkit -e`
+      nohup $cmd </dev/null >$avis_logfile 2>&1 &
+      echo $! >$avis_pidfile
+    ) >/dev/null 2>&1
+
+%stop -u @l_rusr@
+    rcService avis enable yes || exit 0
+    rcService avis active no && exit 0
+    avis_signal TERM
+    sleep 2
+    rm -f $avis_pidfile 2>/dev/null || true
+
+%restart -u @l_rusr@
+    rcService avis enable yes || exit 0
+    rcService avis active no && exit 0
+    rc avis stop
+    rc avis start
+
+%daily -u @l_rusr@
+    rcService avis enable yes || exit 0
+    shtool rotate -f \
+        -n $avis_log_numfiles -s $avis_log_minsize -d \
+        -z $avis_log_complevel -o @l_rusr@ -g @l_rgrp@ -m 644 \
+        -P "$avis_log_prolog" \
+        -E "$avis_log_epilog; rc avis restart" \
+        @l_prefix@/var/avis/avisd.log
+