activemq.spec 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. ##
  2. ## activemq.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2009 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package information
  24. Name: activemq
  25. Summary: Enterprise Messaging and Integration Patterns Provider
  26. URL: http://activemq.apache.org/
  27. Vendor: Apache Foundation
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: EVAL
  31. Group: Network
  32. License: Apache
  33. Version: 5.2.0
  34. Release: 20091011
  35. # list of sources
  36. Source0: http://www.apache.org/dist/activemq/apache-activemq/%{version}/apache-activemq-%{version}-bin.tar.gz
  37. Source1: activemq.txt
  38. Source2: rc.activemq
  39. # build information
  40. Prefix: %{l_prefix}
  41. BuildRoot: %{l_buildroot}
  42. BuildPreReq: OpenPKG, openpkg >= 20060823
  43. PreReq: OpenPKG, openpkg >= 20060823, java
  44. AutoReq: no
  45. AutoReqProv: no
  46. %description
  47. ActiveMQ is the most popular and powerful Open-Source Enterprise
  48. Messaging and Integration Patterns provider. ActiveMQ supports
  49. OpenWire, STOMP and XMPP transports. ActiveMQ supports JMS 1.1
  50. including support for transient, persistent, transactional and XA
  51. messaging.
  52. %track
  53. prog activemq = {
  54. version = %{version}
  55. url = http://activemq.apache.org/download.html
  56. regex = ActiveMQ\s+(\d+\.\d+\.\d+)\+Release
  57. }
  58. %prep
  59. %setup -q -n apache-activemq-%{version}
  60. %build
  61. %install
  62. rm -rf $RPM_BUILD_ROOT
  63. # create installation hierarchy
  64. %{l_shtool} mkdir -f -p -m 755 \
  65. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  66. $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d \
  67. $RPM_BUILD_ROOT%{l_prefix}/etc/activemq \
  68. $RPM_BUILD_ROOT%{l_prefix}/libexec/activemq \
  69. $RPM_BUILD_ROOT%{l_prefix}/share/activemq/service/WEB-INF \
  70. $RPM_BUILD_ROOT%{l_prefix}/var/activemq/run \
  71. $RPM_BUILD_ROOT%{l_prefix}/var/activemq/log \
  72. $RPM_BUILD_ROOT%{l_prefix}/var/activemq/data
  73. # install program components
  74. %{l_shtool} install -c -m 644 \
  75. bin/run.jar $RPM_BUILD_ROOT%{l_prefix}/libexec/activemq/
  76. cp -rp lib \
  77. $RPM_BUILD_ROOT%{l_prefix}/libexec/activemq/
  78. cp -rp webapps/* \
  79. $RPM_BUILD_ROOT%{l_prefix}/share/activemq/
  80. # post-adjust installation
  81. %{l_shtool} subst \
  82. -e 's;${activemq.base}/conf/credentials\.properties;%{l_prefix}/etc/activemq/activemq.properties;' \
  83. $RPM_BUILD_ROOT%{l_prefix}/share/activemq/admin/WEB-INF/webconsole-embedded.xml
  84. # install run-command script
  85. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  86. %{SOURCE rc.activemq} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  87. # install default configuration
  88. for name in `grep "^<file" %{SOURCE activemq.txt} | sed -e 's;^.*name=";;' -e 's;".*$;;'`; do
  89. (echo ""; cat %{SOURCE activemq.txt}; echo "") |\
  90. sed -e "1,/^<file name=\"$name\">/d" -e "/<\/file>/,\$d" >$name
  91. if [ ".$name" = ".web.xml" ]; then
  92. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  93. $name $RPM_BUILD_ROOT%{l_prefix}/share/activemq/service/WEB-INF/
  94. elif [ ".$name" = ".activemq.conf" ]; then
  95. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  96. $name $RPM_BUILD_ROOT%{l_prefix}/etc/apache/apache.d/
  97. else
  98. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  99. $name $RPM_BUILD_ROOT%{l_prefix}/etc/activemq/
  100. fi
  101. done
  102. %{l_shtool} install -c -m 644 \
  103. conf/broker.ks $RPM_BUILD_ROOT%{l_prefix}/etc/activemq/activemq.broker.ks
  104. %{l_shtool} install -c -m 644 \
  105. conf/broker.ts $RPM_BUILD_ROOT%{l_prefix}/etc/activemq/activemq.broker.ts
  106. # determine installation files
  107. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  108. %{l_files_std} \
  109. '%config %{l_prefix}/etc/activemq/*' \
  110. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/activemq/*'
  111. %files -f files
  112. %clean
  113. rm -rf $RPM_BUILD_ROOT
  114. %post
  115. # after upgrade, restart service
  116. if [ $1 -eq 2 ]; then
  117. eval `%{l_rc} activemq status 2>/dev/null`
  118. [ ".$activemq_active" = .yes ] && %{l_rc} activemq restart
  119. fi
  120. exit 0
  121. %preun
  122. if [ $1 -eq 0 ]; then
  123. # before erase, stop service and remove log files
  124. %{l_rc} activemq stop 2>/dev/null
  125. rm -f $RPM_INSTALL_PREFIX/var/activemq/log/* >/dev/null 2>&1 || true
  126. rm -f $RPM_INSTALL_PREFIX/var/activemq/run/* >/dev/null 2>&1 || true
  127. rm -rf $RPM_INSTALL_PREFIX/var/activemq/data/* >/dev/null 2>&1 || true
  128. fi
  129. exit 0