net-snmp/net-snmp.spec

415 lines
12 KiB
RPMSpec
Raw Normal View History

#
# spec file for package net-snmp (Version 5.5)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: net-snmp
Version: 5.5
Release: 6
License: BSD3c(or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
#
%define pkg_name net-snmp
%ifnarch s390 s390x
%define with_sensors 1
%endif
%define netsnmp_logfile /var/log/net-snmpd.log
%define netsnmp_agentx_socket_dir_fhs /var/run/agentx
%define netsnmp_agentx_socket_dir_rfc /var/agentx
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: openssl-devel rpm-devel tcpd-devel
%if 0%{?with_sensors}
BuildRequires: libsensors4-devel
%endif
Requires: perl-TermReadKey logrotate
Requires: perl-SNMP = %{version}
PreReq: %insserv_prereq %fillup_prereq /sbin/chkconfig
Provides: snmp ucdsnmp
Obsoletes: snmp ucdsnmp
# bug437293
%ifarch ppc64
Obsoletes: net-snmp-64bit
%endif
#
#
Url: http://sourceforge.net/projects/net-snmp
Source: %{pkg_name}-%{version}.tar.bz2
Source1: rc.net-snmp
Source2: snmpd.conf
Source3: README.SuSE
Source4: rc.snmptrapd
Source5: net-snmp.logrotate
Source6: test_installed
Source7: net-snmp.sysconfig
Source8: net-snmp-rpmlintrc
Source9: baselibs.conf
Patch0: net-snmp-5.5.0-upstream-20100428.patch.bz2
# unused patch atm
Patch1: net-snmp-5.5.0-socket-path.patch
Patch2: net-snmp-5.5.0-testing-empty-arptable.patch
Patch3: net-snmp-5.5.0-pie.patch
Patch4: net-snmp-5.5.0-vendorperl.patch
Patch5: net-snmp-5.5.0-net-snmp-config-headercheck.patch
Patch6: net-snmp-5.5.0-perl-tk-warning.patch
Patch7: net-snmp-5.5.0-velocity-mib.patch
Patch8: net-snmp-5.5.0-use-lmsensors-v3.patch
#
Summary: SNMP Daemon
%description
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
This package was originally based on the CMU 2.1.2.1 snmp code. It was
renamed from cmu-snmp to ucd-snmp in 1995 and later renamed from ucd-snmp
to net-snmp in November 2000.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%define library_name libsnmp20
%package -n libsnmp20
License: BSD3c(or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
Requires: snmp-mibs = %{version}
Requires: perl-base = %{perl_version}
#
Summary: Shared Libraries from net-snmp
%description -n libsnmp20
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
* An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
* Command-line applications to retrieve and manipulate information from
SNMP-capable devices
* A daemon application for receiving SNMP notifications
* A library for developing new SNMP applications, with C and Perl APIs
* A graphical MIB browser.
This package holds the shared libraries from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package devel
License: BSD3c(or similar) ; MIT License (or similar)
Group: Development/Libraries/C and C++
# bug437293
%ifarch ppc64
Obsoletes: net-snmp-devel-64bit
%endif
#
Requires: %{library_name} = %{version}
# for mib2c
Requires: perl-SNMP = %{version}
Requires: libopenssl-devel rpm-devel tcpd-devel perl zlib-devel
%if 0%{?with_sensors}
Requires: libsensors4-devel
%endif
#
Summary: Development files from net-snmp
%description devel
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
* An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
* Command-line applications to retrieve and manipulate information from
SNMP-capable devices
* A daemon application for receiving SNMP notifications
* A library for developing new SNMP applications, with C and Perl APIs
* A graphical MIB browser.
This package holds the development headers, libraries and API documentation
from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n snmp-mibs
License: BSD3c(or similar) ; MIT License (or similar)
Group: Productivity/Networking/Other
#
Summary: MIB files from net-snmp
%description -n snmp-mibs
Net-SNMP is a suite of applications used to implement SNMP v1, SNMP v2c
and SNMP v3 using both IPv4 and IPv6. The suite includes:
- An extensible agent for responding to SNMP queries including built-in
support for a wide range of MIB information modules
- Command-line applications to retrieve and manipulate information from
SNMP-capable devices
- A daemon application for receiving SNMP notifications
- A library for developing new SNMP applications, with C and Perl APIs
- A graphical MIB browser.
This package holds the MIB files from the net-snmp package.
Authors:
--------
Wes Hardaker <hardaker@users.sourceforge.net>
%package -n perl-SNMP
License: GPLv2+
Group: Development/Libraries/Perl
Requires: %{pkg_name} = %{version}
Requires: perl-base = %{perl_version}
#
Summary: Perl5 SNMP Extension Module
%description -n perl-SNMP
The Perl5 'SNMP' Extension Module v3.1.0 for the UCD SNMPv3 library.
Authors:
--------
G.S. Marzot <gmarzot@nortelnetworks.com>
%prep
%setup -q -n %{pkg_name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
autoreconf -fi
# possibly add later
# --with-python-modules \ => need python-setuptools
# ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable
export CFLAGS="%{optflags} -fno-strict-aliasing -DNETSNMP_NO_INLINE"
export CFLAGS="%{optflags} -fno-strict-aliasing"
export CFLAGS="$CFLAGS -fstack-protector-all"
%configure \
--with-sys-contact="root@localhost" \
--with-mib-modules="misc/ipfwacc \
ucd-snmp/diskio \
etherlike-mib rmon-mib \
velocity \
%if 0%{?with_sensors}
ucd-snmp/lmsensorsMib \
%endif
smux \
ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
ip-mib/ipDefaultRouterTable ip-mib/ipAddressPrefixTable \
ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable" \
--with-persistent-directory=/var/lib/net-snmp \
--with-agentx-socket=%{netsnmp_agentx_socket_dir_fhs}/master \
--with-sys-location="unknown" \
--with-logfile=%{netsnmp_logfile} \
--with-libwrap=%{_prefix} \
--with-defaults \
--enable-shared \
--disable-static \
--enable-as-needed \
--without-root-access \
--enable-local-smux \
--enable-ipv6 \
--enable-ucd-snmp-compatibility
%{__make} all
%check
%ifnarch %arm
ulimit -c unlimited
%{__make} test ||:
%{__make} test TESTOPTS='-P tcp' ||:
%endif
%{__make} perlmodules ||:
LD_RUN_PATH="$PWD/snmplib/.libs" LD_LIBRARY_PATH="${PWD}/snmplib/.libs:${PWD}/agent/.libs:${PWD}/agent/helpers/.libs" %{__make} perltest ||:
%install
%makeinstall INSTALL_PREFIX=%{buildroot}
%{__install} -Dd %{buildroot}/var/log %{buildroot}/var/lib/net-snmp %{buildroot}/usr/lib/net-snmp/agents %{buildroot}%{netsnmp_agentx_socket_dir_fhs}
%{__install} -D -m 0755 %{SOURCE1} %{buildroot}/etc/init.d/snmpd
%{__install} -D -m 0600 %{SOURCE2} %{buildroot}/etc/snmp/snmpd.conf
%{__install} -m 0644 %{SOURCE3} .
%{__install} -m 0644 %{SOURCE4} .
%{__install} -D -m 0644 %{SOURCE5} %{buildroot}/etc/logrotate.d/net-snmp
%{__install} -m 0744 %{SOURCE6} testing/
%{__ln_s} -f /etc/init.d/snmpd %{buildroot}%{_sbindir}/rcsnmpd
%{__install} -m 0644 /dev/null %{buildroot}%{netsnmp_logfile}
pushd perl
%perl_make_install
%perl_process_packlist
%{__rm} -f %{buildroot}/%{perl_vendorarch}/Bundle/Makefile.subs.pl
popd
%{__grep} -v "^#define PACKAGE" %{buildroot}%{_includedir}/net-snmp/net-snmp-config.h > \
%{buildroot}%{_includedir}/net-snmp/net-snmp-config.h.new
%{__mv} %{buildroot}%{_includedir}/net-snmp/net-snmp-config.h{.new,}
%{__install} -D -m 0644 %{S:7} \
%{buildroot}/var/adm/fillup-templates/sysconfig.%{pkg_name}
#
%{__ln_s} -f %{netsnmp_agentx_socket_dir_fhs} %{buildroot}%{netsnmp_agentx_socket_dir_rfc}
#
%clean
%{__rm} -rf %{buildroot}
%preun
%stop_on_removal snmpd
%post
# if we are upgrading from older distros the config should be moved
# to the new place
CONFD="/etc/snmp"
OCONF="/etc/snmpd.conf"
NCONF="${CONFD}/snmpd.conf"
NCONFB="${CONFD}/snmpd.conf.rpmsave"
if [ -e "$OCONF" ] ; then
#
# in worst case we will get:
# /etc/snmp/snmpd.conf - the old /etc/snmpd.conf
# /etc/snmp/snmpd.conf.rpmnew - the config of the newly installed package.
# /etc/snmp/snmpd.conf.rpmsave - the old /etc/snmp/snmpd.conf
#
if [ ! -d "$CONFD" ] ; then
mkdir "$CONFD"
fi
#
# we dont need to handle the case that /etc/snmp/snmpd.conf
# exists. rpm does that for us.
# it creates /etc/snmp/snmpd.conf.rpmnew
#
if [ -e "$NCONF" ] ; then
mv "$NCONF" "$NCONFB"
echo "warning: /etc/snmp/snmpd.conf backed up as /etc/snmp/snmpd.conf.rpmsave" >&2
fi
echo "warning: /etc/snmpd.conf moved to /etc/snmp/snmpd.conf" >&2
mv "$OCONF" "$NCONF"
fi
# we might be updating from ucdsnmp soon
/sbin/chkconfig -c snmpd 2> /dev/null && FIRST_ARG=2
%{fillup_only}
%postun
%restart_on_update snmpd
%{insserv_cleanup}
%post -n %{library_name} -p /sbin/ldconfig
%postun -n %{library_name} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AGENT.txt COPYING EXAMPLE.conf EXAMPLE.conf.def
%doc FAQ NEWS TODO rc.snmptrapd
%doc README README.agent-mibs README.agentx README.krb5 README.snmpv3 README.thread
%dir /etc/snmp
%config(noreplace) /etc/snmp/snmpd.conf
%config /etc/init.d/snmpd
%{_bindir}/encode_keychange
%{_bindir}/fixproc
%{_bindir}/ipf-mod.pl
%{_bindir}/net-snmp-config
%{_bindir}/snmpbulkget
%{_bindir}/snmpbulkwalk
%{_bindir}/snmpcheck
%{_bindir}/snmpconf
%{_bindir}/snmpdelta
%{_bindir}/snmpdf
%{_bindir}/snmpget
%{_bindir}/snmpgetnext
%{_bindir}/snmpinform
%{_bindir}/snmpnetstat
%{_bindir}/snmpset
%{_bindir}/snmpstatus
%{_bindir}/snmptable
%{_bindir}/snmptest
%{_bindir}/snmptranslate
%{_bindir}/snmptrap
%{_bindir}/snmpusm
%{_bindir}/snmpvacm
%{_bindir}/snmpwalk
%{_bindir}/traptoemail
%{_bindir}/net-snmp-create-v3-user
%dir %{_prefix}/lib/net-snmp
%dir %{_prefix}/lib/net-snmp/agents
%{_mandir}/man[158]/*
%{_sbindir}/*
/var/lib/net-snmp
%dir %ghost %attr(700,root,root) %{netsnmp_agentx_socket_dir_fhs}
%ghost %{netsnmp_logfile}
%config(noreplace) /etc/logrotate.d/net-snmp
/var/adm/fillup-templates/sysconfig.%{pkg_name}
%{netsnmp_agentx_socket_dir_rfc}
%{_datadir}/snmp/snmpconf-data/
%{_datadir}/snmp/snmp_perl.pl
%{_datadir}/snmp/snmp_perl_trapd.pl
%files -n snmp-mibs
%defattr(-,root,root)
%dir %{_datadir}/snmp
%{_datadir}/snmp/mibs/
%files -n %{library_name}
%defattr(-,root,root)
%{_libdir}/libsnmp*.so.*
%{_libdir}/libnetsnmp*.so.*
%files devel
%defattr(-,root,root)
%doc ChangeLog PORTING
%{_mandir}/man3/*
%{_includedir}/ucd-snmp
%{_includedir}/net-snmp
%{_libdir}/libsnmp*.la
%{_libdir}/libsnmp*.so
%{_libdir}/libnetsnmp*.la
%{_libdir}/libnetsnmp*.so
%{_bindir}/mib2c
%{_bindir}/mib2c-update
%{_datadir}/snmp/mib2c*
%files -n perl-SNMP
%defattr(-,root,root)
%{perl_vendorarch}/auto/SNMP
%{perl_vendorarch}/auto/NetSNMP
%{perl_vendorarch}/auto/Bundle
%{perl_vendorarch}/SNMP.pm
%{perl_vendorarch}/NetSNMP
/var/adm/perl-modules/%{name}
%{_bindir}/tkmib
%changelog