parent
fe2ae23d03
commit
d3eba89274
@ -11,7 +11,7 @@
|
||||
Summary: A collection of SNMP protocol tools and libraries
|
||||
Name: net-snmp
|
||||
Version: 5.7
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
Epoch: 1
|
||||
|
||||
License: BSD
|
||||
@ -27,6 +27,8 @@ Source6: net-snmp-trapd.redhat.conf
|
||||
Source7: net-snmpd.sysconfig
|
||||
Source8: net-snmptrapd.sysconfig
|
||||
Source9: net-snmp-tmpfs.conf
|
||||
Source10: snmpd.service
|
||||
Source11: snmptrapd.service
|
||||
Patch1: net-snmp-5.6-pie.patch
|
||||
Patch2: net-snmp-5.5-dir-fix.patch
|
||||
Patch3: net-snmp-5.6-multilib.patch
|
||||
@ -35,6 +37,7 @@ Patch5: net-snmp-5.5-apsl-copying.patch
|
||||
Patch6: net-snmp-5.5-perl-linking.patch
|
||||
Patch7: net-snmp-5.6-test-debug.patch
|
||||
Patch8: net-snmp-5.6.1-mysql.patch
|
||||
Patch9: net-snmp-5.7-systemd.patch
|
||||
|
||||
Requires(post): chkconfig
|
||||
Requires(preun): chkconfig
|
||||
@ -44,6 +47,11 @@ Requires(preun): initscripts
|
||||
Requires(preun): coreutils
|
||||
Requires: %{name}-libs = %{epoch}:%{version}-%{release}
|
||||
Requires: mysql-libs
|
||||
# This is actually needed for the %triggerun script but Requires(triggerun)
|
||||
# is not valid. We can use %post because this particular %triggerun script
|
||||
# should fire just after this package is installed.
|
||||
Requires(post): systemd-sysv
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
|
||||
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
|
||||
@ -55,6 +63,7 @@ BuildRequires: mysql-devel
|
||||
BuildRequires: net-tools
|
||||
# for make test
|
||||
BuildRequires: perl(TAP::Harness)
|
||||
BuildRequires: systemd-units
|
||||
%ifnarch s390 s390x
|
||||
BuildRequires: lm_sensors-devel >= 3
|
||||
%endif
|
||||
@ -174,6 +183,7 @@ Net-SNMP toolkit library.
|
||||
#%patch6 -p1 -b .perl-linking
|
||||
%patch7 -p1
|
||||
%patch8 -p1 -b .mysql
|
||||
%patch9 -p1 -b .systemd
|
||||
|
||||
%ifarch sparc64
|
||||
# disable failing test - see https://bugzilla.redhat.com/show_bug.cgi?id=680697
|
||||
@ -218,6 +228,7 @@ MIBS="$MIBS ucd-snmp/lmsensorsMib"
|
||||
--with-transports="DTLSUDP TLSTCP" \
|
||||
--with-security-modules=tsm \
|
||||
--with-mysql \
|
||||
--with-systemd \
|
||||
--with-sys-contact="root@localhost" <<EOF
|
||||
EOF
|
||||
|
||||
@ -318,8 +329,11 @@ chmod 644 local/passtest local/ipf-mod.pl
|
||||
install -m 755 -d $RPM_BUILD_ROOT/usr/include/net-snmp/agent/util_funcs
|
||||
install -m 644 agent/mibgroup/util_funcs/*.h $RPM_BUILD_ROOT/usr/include/net-snmp/agent/util_funcs
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/
|
||||
# systemd stuff
|
||||
install -m 755 -d $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/
|
||||
install -m 644 %SOURCE9 $RPM_BUILD_ROOT/%{_sysconfdir}/tmpfiles.d/net-snmp.conf
|
||||
install -m 755 -d $RPM_BUILD_ROOT/%{_unitdir}
|
||||
install -m 644 %SOURCE10 %SOURCE11 $RPM_BUILD_ROOT/%{_unitdir}/
|
||||
|
||||
%check
|
||||
%if %{netsnmp_check}
|
||||
@ -330,29 +344,41 @@ LD_LIBRARY_PATH=${RPM_BUILD_ROOT}/%{_libdir} make test
|
||||
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add snmpd
|
||||
/sbin/chkconfig --add snmptrapd
|
||||
|
||||
# move local state files from /var/net-snmp to new location when updating the package
|
||||
# (Fedora 11: /var/net-snmp, Fedora 12: /var/lib/net-snmp)
|
||||
/bin/mv %{_localstatedir}/net-snmp/* %{_localstatedir}/lib/net-snmp/ &>/dev/null || :
|
||||
|
||||
if [ $1 -eq 1 ] ; then
|
||||
# Initial installation
|
||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
%preun
|
||||
if [ $1 = 0 ]; then
|
||||
service snmpd stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del snmpd
|
||||
service snmptrapd stop >/dev/null 2>&1
|
||||
/sbin/chkconfig --del snmptrapd
|
||||
/bin/systemctl --no-reload disable snmpd.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl --no-reload disable snmptrapd.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop snmpd.service > /dev/null 2>&1 || :
|
||||
/bin/systemctl stop snmptrapd.service > /dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
|
||||
%postun
|
||||
if [ "$1" -ge "1" ]; then
|
||||
service snmpd condrestart >/dev/null 2>&1 || :
|
||||
service snmptrapd condrestart >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart snmpd.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart snmptrapd.service >/dev/null 2>&1 || :
|
||||
fi
|
||||
|
||||
|
||||
%triggerun -- net-snmp < 1:5.7-5
|
||||
# Convert SysV -> systemd.
|
||||
# Save the current service runlevel info,
|
||||
# User must manually run systemd-sysv-convert --apply snmpd
|
||||
# to migrate them to systemd targets
|
||||
echo "hello world" >> /tmp/snmp
|
||||
echo date >>/tmp/snmp
|
||||
/usr/bin/systemd-sysv-convert --save snmpd >/dev/null 2>&1 ||:
|
||||
/usr/bin/systemd-sysv-convert --save snmptrapd >/dev/null 2>&1 ||:
|
||||
/sbin/chkconfig --del snmpd >/dev/null 2>&1 || :
|
||||
/sbin/chkconfig --del snmptrapd >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart snmpd.service >/dev/null 2>&1 || :
|
||||
/bin/systemctl try-restart snmptrapd.service >/dev/null 2>&1 || :
|
||||
|
||||
%post libs -p /sbin/ldconfig
|
||||
|
||||
%postun libs -p /sbin/ldconfig
|
||||
@ -386,6 +412,7 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%dir %{_localstatedir}/lib/net-snmp
|
||||
%dir %{_localstatedir}/run/net-snmp
|
||||
%config(noreplace) %{_sysconfdir}/tmpfiles.d/net-snmp.conf
|
||||
%{_unitdir}/snmp*
|
||||
|
||||
%files utils
|
||||
%defattr(-,root,root,-)
|
||||
@ -444,6 +471,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
||||
%{_datadir}/snmp/mibs/*
|
||||
|
||||
%changelog
|
||||
* Tue Aug 9 2011 Jan Safranek <jsafrane@redhat.com> - 1:5.7-5
|
||||
- integrated with systemd (#718183)
|
||||
|
||||
* Thu Jul 21 2011 Petr Sabata <contyk@redhat.com> - 1:5.7-4
|
||||
- Perl mass rebuild
|
||||
|
||||
|
@ -1,2 +1,6 @@
|
||||
# WARNING:
|
||||
# This file is only for compatibility with SysV init scripts if someone uses
|
||||
# them! systemd does not use this file when starting snmpd!
|
||||
#
|
||||
# snmpd command line options
|
||||
# OPTIONS="-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"
|
||||
|
@ -1,2 +1,6 @@
|
||||
# WARNING:
|
||||
# This file is only for compatibility with SysV init scripts if someone uses
|
||||
# them! systemd does not use this file when starting snmpd!
|
||||
#
|
||||
# snmptrapd command line options
|
||||
# OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
|
||||
|
11
snmpd.service
Normal file
11
snmpd.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Simple Network Management Protocol (SNMP) Daemon.
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/sbin/snmpd -LS0-6d -f
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
11
snmptrapd.service
Normal file
11
snmptrapd.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Simple Network Management Protocol (SNMP) Trap Daemon.
|
||||
After=syslog.target network.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/sbin/snmptrapd -Lsd -f
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user