snmpdx.spec 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ##
  2. ## snmpdx.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: snmpdx
  27. Summary: SNMP Daemon Extension
  28. URL: http://www.ossp.org/pkg/tool/snmpdx/
  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.2.10
  36. Release: 20040816
  37. # list of sources
  38. Source0: ftp://ftp.ossp.org/pkg/tool/snmpdx/snmpdx-%{version}.tar.gz
  39. Source1: rc.snmpdx
  40. # build information
  41. Prefix: %{l_prefix}
  42. BuildRoot: %{l_buildroot}
  43. BuildPreReq: OpenPKG, openpkg >= 20040130, perl, snmp
  44. PreReq: OpenPKG, openpkg >= 20040130, perl, snmp
  45. AutoReq: no
  46. AutoReqProv: no
  47. %description
  48. OSSP snmpdx is a framework for easily hooking into net-snmp's
  49. snmpd(8) and providing an own SNMP MIB and the OID implementing
  50. probes. It is a Perl program which either can be configured as a
  51. pass (not recommended) or pass_persist (recommended) program into
  52. snmpd.conf.
  53. %track
  54. prog snmpdx = {
  55. version = %{version}
  56. url = ftp://ftp.ossp.org/pkg/tool/snmpdx/
  57. regex = snmpdx-(__VER__)\.tar\.gz
  58. }
  59. %prep
  60. %setup -q
  61. %build
  62. # configure program
  63. ./configure \
  64. --prefix=%{l_prefix} \
  65. --with-openpkg=%{l_prefix} \
  66. --with-snmp=%{l_prefix} \
  67. --with-perl=%{l_prefix}/bin/perl
  68. # build program
  69. %{l_make} %{l_mflags -O}
  70. %install
  71. # install program
  72. rm -rf $RPM_BUILD_ROOT
  73. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  74. # install run-command script
  75. %{l_shtool} mkdir -f -p -m 755 \
  76. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  77. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  78. %{SOURCE rc.snmpdx} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  79. # determine installation files
  80. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  81. %{l_files_std} \
  82. '%config %{l_prefix}/etc/snmpdx/snmpdx.cfg'
  83. %files -f files
  84. %clean
  85. rm -rf $RPM_BUILD_ROOT
  86. %post
  87. # add snmpd(8) hook
  88. snmpdx_mibprefix=`$RPM_INSTALL_PREFIX/bin/snmptranslate \
  89. -M $RPM_INSTALL_PREFIX/share/snmp/mibs:$RPM_INSTALL_PREFIX/share/snmpdx -m snmpdx -Ib -On snmpdx`
  90. echo "pass_persist $snmpdx_mibprefix $RPM_INSTALL_PREFIX/sbin/snmpdx" |\
  91. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  92. -a -s -i "$RPM_INSTALL_PREFIX:snmpdx" $RPM_INSTALL_PREFIX/etc/snmp/snmpd.conf
  93. %preun
  94. # remove snmpd(8) hook
  95. $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
  96. -r -s -i "$RPM_INSTALL_PREFIX:snmpdx" $RPM_INSTALL_PREFIX/etc/snmp/snmpd.conf