flow2rrd.spec 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. ##
  2. ## flow2rrd.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package information
  26. Name: flow2rrd
  27. Summary: NetFlow to Round-Robin Database
  28. URL: http://www.ossp.org/pkg/tool/flow2rrd/
  29. Vendor: The OSSP Project
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG
  32. Class: EVAL
  33. Group: Network
  34. License: GPL
  35. Version: 0.9.1
  36. Release: 20041227
  37. # list of sources
  38. Source0: ftp://ftp.ossp.org/pkg/tool/flow2rrd/flow2rrd-%{version}.tar.gz
  39. Patch0: flow2rrd.patch
  40. # build information
  41. Prefix: %{l_prefix}
  42. BuildRoot: %{l_buildroot}
  43. BuildPreReq: OpenPKG, openpkg >= 20040130, perl
  44. PreReq: OpenPKG, openpkg >= 20040130
  45. PreReq: perl, perl-time, perl-text, perl-net >= 5.8.6-20041217, perl-www
  46. PreReq: cfg, cfg::with_perl = yes
  47. PreReq: flowtools, flowtools::with_perl = yes
  48. PreReq: rrdtool, apache
  49. AutoReq: no
  50. AutoReqProv: no
  51. %description
  52. OSSP flow2rrd is a companion tool to the Flow-Tools toolkit for
  53. storing NetFlow network traffic data in an accumulating fixed-size
  54. RRDTool Round-Robin-Database (RRD) for visualization purposes.
  55. %track
  56. prog flow2rrd = {
  57. version = %{version}
  58. url = ftp://ftp.ossp.org/pkg/tool/flow2rrd/
  59. regex = flow2rrd-(__VER__)\.tar\.gz
  60. }
  61. %prep
  62. %setup -q
  63. %patch -p0
  64. %build
  65. # build the program
  66. ./configure \
  67. --prefix=%{l_prefix} \
  68. --sysconfdir=%{l_prefix}/etc/flow2rrd \
  69. --localstatedir=%{l_prefix}/var/flow2rrd \
  70. --with-perl=%{l_prefix}/bin/perl \
  71. --with-pod2man=%{l_prefix}/bin/pod2man
  72. %{l_make} %{l_mflags}
  73. # create storage wrapper for flow-capture(1)'s -R option
  74. ( echo "#!/bin/sh"
  75. echo "if [ \$# -ne 1 ]; then"
  76. echo " echo \"\$0:ERROR: invalid number of arguments\" 1>&2"
  77. echo " exit 1"
  78. echo "fi"
  79. echo "exec %{l_prefix}/bin/flow2rrd --store <\$1"
  80. ) >flow2rrd-store
  81. %install
  82. # install program
  83. rm -rf $RPM_BUILD_ROOT
  84. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  85. # install storage wrapper
  86. %{l_shtool} install -c -m 755 \
  87. flow2rrd-store $RPM_BUILD_ROOT%{l_prefix}/bin/
  88. # determine installation files
  89. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  90. %{l_files_std} \
  91. '%config %{l_prefix}/etc/flow2rrd/flow2rrd.cfg' \
  92. '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/flow2rrd'
  93. %files -f files
  94. %clean
  95. rm -rf $RPM_BUILD_ROOT
  96. %post
  97. if [ ".$1" = .1 ]; then
  98. # add hook to Apache configuration
  99. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  100. if [ -f $apacheconf ]; then
  101. ( echo "ScriptAlias /flow2rrd $RPM_INSTALL_PREFIX/bin/flow2rrd"
  102. ) | $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  103. -a -i "$RPM_INSTALL_PREFIX:flow2rrd" $apacheconf
  104. fi
  105. fi
  106. %preun
  107. # before erase, remove RRD
  108. [ $1 -eq 0 ] || exit 0
  109. rm -f $RPM_INSTALL_PREFIX/var/flow2rrd/* >/dev/null 2>&1 || true
  110. exit 0
  111. %postun
  112. if [ ".$1" = .0 ]; then
  113. # remove hook from Apache configuration
  114. apacheconf="$RPM_INSTALL_PREFIX/etc/apache/apache.conf"
  115. if [ -f $apacheconf ]; then
  116. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  117. -r -i "$RPM_INSTALL_PREFIX:flow2rrd" $apacheconf
  118. fi
  119. fi