sec.spec 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. ##
  2. ## sec.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 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 version
  25. %define V_dist 2.3.3
  26. %define V_opkg 2.3.3
  27. # package information
  28. Name: sec
  29. Summary: Simple Event Correlation
  30. URL: http://kodu.neti.ee/~risto/sec/
  31. Vendor: Risto Vaarandi
  32. Packager: OpenPKG
  33. Distribution: OpenPKG
  34. Class: PLUS
  35. Group: System
  36. License: Open Source
  37. Version: %{V_opkg}
  38. Release: 20060322
  39. # list of sources
  40. Source0: http://osdn.dl.sourceforge.net/simple-evcorr/sec-%{V_dist}.tar.gz
  41. Source1: rc.sec
  42. Source2: sec.conf
  43. Source3: sec.rule
  44. # build information
  45. Prefix: %{l_prefix}
  46. BuildRoot: %{l_buildroot}
  47. BuildPreReq: OpenPKG, openpkg >= 20040130
  48. PreReq: OpenPKG, openpkg >= 20040130, perl
  49. AutoReq: no
  50. AutoReqProv: no
  51. %description
  52. SEC is a tool that was designed to solve event correlation tasks
  53. in network and system management. Event correlation is a process
  54. where a stream of primitive events is processed in order to detect
  55. composite events that correspond to event patterns in the event
  56. stream. After startup SEC reads lines from files, named pipes,
  57. or standard input, matches the lines with regular expressions to
  58. recognize input events, and correlates events according to the rules
  59. that are specified in its configuration file. SEC can be configured
  60. to produce its output by executing user-specified shell commands,
  61. and by using utilities like snmptrap(1) or snmpnotify(1), SEC can
  62. generate network management events as output. Other options for
  63. producing output events are described further in this man page.
  64. %track
  65. prog sec = {
  66. version = %{V_dist}
  67. url = http://prdownloads.sourceforge.net/simple-evcorr/
  68. regex = sec-(__VER__)\.tar\.gz
  69. }
  70. %prep
  71. %setup -q -n sec-%{V_dist}
  72. %build
  73. %install
  74. # create installation hierarchy
  75. rm -rf $RPM_BUILD_ROOT
  76. %{l_shtool} mkdir -f -p -m 755 \
  77. $RPM_BUILD_ROOT%{l_prefix}/bin \
  78. $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
  79. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  80. $RPM_BUILD_ROOT%{l_prefix}/etc/sec \
  81. $RPM_BUILD_ROOT%{l_prefix}/var/sec
  82. # install program and manual page
  83. %{l_shtool} install -c -m 755 \
  84. -e 's;/usr/bin/perl;%{l_prefix}/bin/perl;' \
  85. sec.pl $RPM_BUILD_ROOT%{l_prefix}/bin/sec
  86. %{l_shtool} install -c -m 644 \
  87. sec.pl.man $RPM_BUILD_ROOT%{l_prefix}/man/man1/sec.1
  88. # install default configuration
  89. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  90. %{SOURCE sec.conf} %{SOURCE sec.rule} \
  91. $RPM_BUILD_ROOT%{l_prefix}/etc/sec/
  92. # install run-command script
  93. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  94. %{SOURCE rc.sec} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  95. # determine installation files
  96. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  97. %{l_files_std} \
  98. '%config %{l_prefix}/etc/sec/*'
  99. %files -f files
  100. %clean
  101. rm -rf $RPM_BUILD_ROOT
  102. %post
  103. # after upgrade, restart service
  104. [ $1 -eq 2 ] || exit 0
  105. eval `%{l_rc} sec status 2>/dev/null`
  106. [ ".$sec_active" = .yes ] && %{l_rc} sec restart
  107. exit 0
  108. %preun
  109. # before erase, stop service and remove log files
  110. [ $1 -eq 0 ] || exit 0
  111. %{l_rc} sec stop 2>/dev/null
  112. rm -f $RPM_INSTALL_PREFIX/var/sec/sec.* >/dev/null 2>&1 || true
  113. exit 0