flowd.spec 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. ##
  2. ## flowd.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 information
  25. Name: flowd
  26. Summary: NetFlow Collector
  27. URL: http://www.mindrot.org/flowd.html
  28. Vendor: Damien Miller
  29. Packager: OpenPKG
  30. Distribution: OpenPKG
  31. Class: EVAL
  32. Group: Network
  33. License: BSD
  34. Version: 0.9
  35. Release: 20060226
  36. # package options
  37. %option with_fsl yes
  38. %option with_perl yes
  39. # list of sources
  40. Source0: http://www.mindrot.org/files/flowd/flowd-%{version}.tar.gz
  41. Source1: flowd.conf
  42. Source2: rc.flowd
  43. Source3: fsl.flowd
  44. Patch0: flowd.patch
  45. # build information
  46. Prefix: %{l_prefix}
  47. BuildRoot: %{l_buildroot}
  48. BuildPreReq: OpenPKG, openpkg >= 20040130, bison
  49. PreReq: OpenPKG, openpkg >= 20040130
  50. %if "%{with_fsl}" == "yes"
  51. BuildPreReq: fsl >= 1.2.0
  52. PreReq: fsl >= 1.2.0
  53. %endif
  54. %if "%{with_perl}" == "yes"
  55. BuildPreReq: perl, perl-openpkg
  56. PreReq: perl
  57. %endif
  58. AutoReq: no
  59. AutoReqProv: no
  60. %description
  61. Flowd is a small, fast and secure NetFlow collector. It understands
  62. NetFlow protocol 1, 5, 7 and 9 (including IPv6 flows), supports both
  63. IPv4 and IPv6 transport of flows, is privilege-separated to limit
  64. the impact of any compromise, supports filtering and tagging of
  65. flows using a packet filter-like syntax, stores recorded flow data
  66. in a compact binary format which supports run-time choice over which
  67. flow fields are stored, and ships with Perl interface for reading
  68. and parsing the on-disk record format.
  69. %track
  70. prog flowd = {
  71. version = %{version}
  72. url = http://www.mindrot.org/flowd.html
  73. regex = flowd-(__VER__)\.tar\.gz
  74. }
  75. %prep
  76. %setup -q
  77. %patch -p0
  78. %build
  79. # configure program
  80. %{l_shtool} subst \
  81. -e 's;_flowd;%{l_rusr};g' \
  82. flowd.h
  83. CC="%{l_cc}" \
  84. CFLAGS="%{l_cflags -O}" \
  85. CPPFLAGS="%{l_cppflags}" \
  86. LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
  87. LIBS="%{l_fsl_libs}" \
  88. ./configure \
  89. --prefix=%{l_prefix} \
  90. --sysconfdir=%{l_prefix}/etc/flowd \
  91. --localstatedir=%{l_prefix}/var/flowd \
  92. --disable-gcc-warnings
  93. # build program
  94. %{l_make} %{l_mflags -O}
  95. %if "%{with_perl}" == "yes"
  96. # build Perl API
  97. %{l_prefix}/bin/perl-openpkg prepare
  98. %{l_prefix}/bin/perl-openpkg -d Flowd configure build
  99. %endif
  100. %install
  101. # install program
  102. rm -rf $RPM_BUILD_ROOT
  103. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  104. # strip down installation
  105. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  106. %if "%{with_perl}" == "yes"
  107. # install Perl API
  108. %{l_prefix}/bin/perl-openpkg -d Flowd install
  109. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  110. %else
  111. >perl-openpkg-files
  112. %endif
  113. # install default configuration
  114. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  115. %{SOURCE flowd.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/flowd/
  116. # install run-command script
  117. %{l_shtool} mkdir -f -p -m 755 \
  118. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  119. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  120. %{SOURCE rc.flowd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  121. # install OSSP fsl configuration
  122. %{l_shtool} mkdir -f -p -m 755 \
  123. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  124. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  125. %{SOURCE fsl.flowd} $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  126. # create empty run-time directory
  127. %{l_shtool} mkdir -f -p -m 755 \
  128. $RPM_BUILD_ROOT%{l_prefix}/var/flowd
  129. # determine installation files
  130. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  131. %{l_files_std} `cat perl-openpkg-files` \
  132. '%not %dir %{l_prefix}/etc/fsl' \
  133. '%config %{l_prefix}/etc/fsl/fsl.flowd' \
  134. '%config %{l_prefix}/etc/flowd/flowd.conf' \
  135. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/flowd'
  136. %files -f files
  137. %clean
  138. rm -rf $RPM_BUILD_ROOT
  139. %post
  140. # after upgrade, restart service
  141. [ $1 -eq 2 ] || exit 0
  142. eval `%{l_rc} flowd status 2>/dev/null`
  143. [ ".$flowd_active" = .yes ] && %{l_rc} flowd restart
  144. exit 0
  145. %preun
  146. # before erase, stop service and remove log files
  147. [ $1 -eq 0 ] || exit 0
  148. %{l_rc} flowd stop 2>/dev/null
  149. rm -f $RPM_INSTALL_PREFIX/var/flowd/* >/dev/null 2>&1 || true
  150. exit 0