avis.spec 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ##
  2. ## avis.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2007 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2007 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  24. # package versions
  25. %define V_avis_server 1.1.0
  26. %define V_avis_client 1.0.2
  27. # package information
  28. Name: avis
  29. Summary: Event Router
  30. URL: http://avis.sourceforge.net/
  31. Vendor: Matthew Phillip
  32. Packager: OpenPKG Foundation e.V.
  33. Distribution: OpenPKG Community
  34. Class: EVAL
  35. Group: InstantMessaging
  36. License: GPL
  37. Version: %{V_avis_server}
  38. Release: 20070901
  39. # list of sources
  40. Source0: http://switch.dl.sourceforge.net/avis/avis-src-%{V_avis_server}.zip
  41. Source1: http://switch.dl.sourceforge.net/avis/avis-client-%{V_avis_client}.zip
  42. Source2: rc.avis
  43. # build information
  44. Prefix: %{l_prefix}
  45. BuildRoot: %{l_buildroot}
  46. BuildPreReq: OpenPKG, openpkg >= 20060823
  47. PreReq: OpenPKG, openpkg >= 20060823, java, JAVA-JDK
  48. AutoReq: no
  49. AutoReqProv: no
  50. %description
  51. Avis is a multicast event bus. It provides a fast, publish/subscribe
  52. event routing service compatible with the commercial Elvin
  53. implementation developed by Mantara Software. Elvin routers can be
  54. federated together to form wide-area event notification networks.
  55. Clients can exchange events with other clients anywhere on the bus,
  56. subscribing to messages using pattern-matching expressions that
  57. select messages based on their content.
  58. %track
  59. prog avis:server = {
  60. version = %{V_avis_server}
  61. url = http://prdownloads.sourceforge.net/avis/
  62. regex = avis-src-(__VER__)\.zip
  63. }
  64. prog avis:client = {
  65. version = %{V_avis_client}
  66. url = http://prdownloads.sourceforge.net/avis/
  67. regex = avis-client-(__VER__)\.zip
  68. }
  69. %prep
  70. %setup -q -T -c
  71. %{l_prefix}/bin/unzip -q -x %{SOURCE0}
  72. %{l_prefix}/bin/unzip -q -x %{SOURCE1}
  73. %build
  74. %install
  75. # create installation hierarchy
  76. rm -rf $RPM_BUILD_ROOT
  77. %{l_shtool} mkdir -f -p -m 755 \
  78. $RPM_BUILD_ROOT%{l_prefix}/bin \
  79. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  80. $RPM_BUILD_ROOT%{l_prefix}/etc/avis \
  81. $RPM_BUILD_ROOT%{l_prefix}/libexec/avis \
  82. $RPM_BUILD_ROOT%{l_prefix}/var/avis
  83. # install Java program
  84. %{l_shtool} install -c -m 644 \
  85. avis-%{V_avis_server}/server/lib/avisd.jar \
  86. avis-client-%{V_avis_client}/client/lib/avis-client.jar \
  87. avis-client-%{V_avis_client}/client/lib/avis-tools.jar \
  88. $RPM_BUILD_ROOT%{l_prefix}/libexec/avis/
  89. # install default server configuration
  90. %{l_shtool} install -c -m 644 \
  91. -e 's;# Listen=elvin://0\.0\.0\.0;Listen=elvin://127.0.0.1:2917;' \
  92. avis-%{V_avis_server}/server/etc/avisd.config \
  93. $RPM_BUILD_ROOT%{l_prefix}/etc/avis/avisd.config
  94. # install client wrapper scripts
  95. ( echo "#!/bin/sh"
  96. echo "exec %{l_prefix}/bin/java -Vsun-jdk -Xverify:none \\%{l_nil}"
  97. echo " -cp %{l_prefix}/libexec/avis/avis-tools.jar:%{l_prefix}/libexec/avis/avis-client.jar \\%{l_nil}"
  98. echo " org.avis.tools.Ec \${1+\"\$@\"}"
  99. ) >avis-ec
  100. ( echo "#!/bin/sh"
  101. echo "exec %{l_prefix}/bin/java -Vsun-jdk -Xverify:none \\%{l_nil}"
  102. echo " -cp %{l_prefix}/libexec/avis/avis-tools.jar:%{l_prefix}/libexec/avis/avis-client.jar \\%{l_nil}"
  103. echo " org.avis.tools.Ep \${1+\"\$@\"}"
  104. ) >avis-ep
  105. %{l_shtool} install -c -m 755 \
  106. avis-ec avis-ep $RPM_BUILD_ROOT%{l_prefix}/bin/
  107. # install run-command script
  108. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  109. %{SOURCE rc.avis} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  110. # determine installation files
  111. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  112. %{l_files_std} \
  113. '%config %{l_prefix}/etc/avis/avisd.config' \
  114. '%dir %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/avis'
  115. %files -f files
  116. %clean
  117. rm -rf $RPM_BUILD_ROOT
  118. %post
  119. # after upgrade, restart service
  120. [ $1 -eq 2 ] || exit 0
  121. eval `%{l_rc} avis status 2>/dev/null`
  122. [ ".$avis_active" = .yes ] && %{l_rc} avis restart
  123. exit 0
  124. %preun
  125. # before erase, stop service and remove log files
  126. [ $1 -eq 0 ] || exit 0
  127. %{l_rc} avis stop 2>/dev/null
  128. rm -f $RPM_INSTALL_PREFIX/var/avis/avis.log* >/dev/null 2>&1 || true
  129. exit 0