Update spec file and remove init files

This commit is contained in:
Josef Ridky 2018-01-31 14:39:32 +01:00
parent 79ba60ff69
commit d5a8b7b457
3 changed files with 109 additions and 384 deletions

View File

@ -2,102 +2,93 @@
%{!?netsnmp_check: %global netsnmp_check 1}
# allow compilation on Fedora 11 and older
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
# Arches on which we need to prevent arch conflicts on net-snmp-config.h
%global multilib_arches %{ix86} ia64 ppc ppc64 s390 s390x x86_64 sparc sparcv9 sparc64 aarch64
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.7.3
Release: 29%{?dist}
Epoch: 1
Summary: A collection of SNMP protocol tools and libraries
Name: net-snmp
Version: 5.7.3
Release: 30%{?dist}
Epoch: 1
License: BSD
Group: System Environment/Daemons
URL: http://net-snmp.sourceforge.net/
Source0: https://downloads.sourceforge.net/project/net-snmp/net-snmp/%{version}/net-snmp-%{version}.tar.gz
Source1: net-snmp.redhat.conf
Source2: net-snmpd.init
Source3: net-snmptrapd.init
Source4: net-snmp-config.h
Source5: net-snmp-config
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
Source12: IETF-MIB-LICENSE.txt
Patch1: net-snmp-5.7.2-pie.patch
Patch2: net-snmp-5.5-dir-fix.patch
Patch3: net-snmp-5.6-multilib.patch
Patch4: net-snmp-5.5-apsl-copying.patch
Patch5: net-snmp-5.6-test-debug.patch
Patch6: net-snmp-5.7.2-systemd.patch
Patch7: net-snmp-5.7.2-create-user-multilib.patch
Patch8: net-snmp-5.7.2-autoreconf.patch
Patch9: net-snmp-5.7-agentx-crash.patch
Patch10: net-snmp-5.5-agentx-disconnect-crash.patch
Patch11: net-snmp-5.7.2-cert-path.patch
Patch12: net-snmp-5.7.3-snmpstatus-null.patch
Patch13: net-snmp-5.7.3-cflags.patch
License: BSD
URL: http://net-snmp.sourceforge.net/
Source0: https://downloads.sourceforge.net/project/net-snmp/net-snmp/%{version}/net-snmp-%{version}.tar.gz
Source1: net-snmp.redhat.conf
Source2: net-snmp-config.h
Source3: net-snmp-config
Source4: net-snmp-trapd.redhat.conf
Source5: net-snmpd.sysconfig
Source6: net-snmptrapd.sysconfig
Source7: net-snmp-tmpfs.conf
Source8: snmpd.service
Source9: snmptrapd.service
Source10: IETF-MIB-LICENSE.txt
Patch1: net-snmp-5.7.2-pie.patch
Patch2: net-snmp-5.5-dir-fix.patch
Patch3: net-snmp-5.6-multilib.patch
Patch4: net-snmp-5.5-apsl-copying.patch
Patch5: net-snmp-5.6-test-debug.patch
Patch6: net-snmp-5.7.2-systemd.patch
Patch7: net-snmp-5.7.2-create-user-multilib.patch
Patch8: net-snmp-5.7.2-autoreconf.patch
Patch9: net-snmp-5.7-agentx-crash.patch
Patch10: net-snmp-5.5-agentx-disconnect-crash.patch
Patch11: net-snmp-5.7.2-cert-path.patch
Patch12: net-snmp-5.7.3-snmpstatus-null.patch
Patch13: net-snmp-5.7.3-cflags.patch
# Remove U64 typedef to build against Perl 5.24
# Backported from upstream
Patch14: net-snmp-5.7.3-Remove-U64-typedef.patch
Patch14: net-snmp-5.7.3-Remove-U64-typedef.patch
# Fixed Makefile.PL to build against Perl 5.24
# For more info: https://rt.perl.org/Public/Bug/Display.html?id=125907
Patch15: net-snmp-5.7.3-Fix-Makefile-PL.patch
Patch15: net-snmp-5.7.3-Fix-Makefile-PL.patch
# Use strtok_r for strtok to avoid a race condition
Patch16: net-snmp-5.7.3-strtok-r.patch
Patch16: net-snmp-5.7.3-strtok-r.patch
# Fix build with MariaDB 10.2
# https://sourceforge.net/p/net-snmp/bugs/2782/
# Josef's patch from https://sourceforge.net/p/net-snmp/bugs/2782/#cbed
# but with the config_os_libs2 portion removed
Patch17: net-snmp-5.7.3-mariadb102.patch
Patch17: net-snmp-5.7.3-mariadb102.patch
# Fix issue with undefined symbol my_progname when try to load
# NetSNMP::TrapReceiver in perl script (#1470004)
# https://sourceforge.net/p/net-snmp/bugs/2792/
# https://sourceforge.net/p/net-snmp/bugs/2792/attachment/0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
# (rebased on 5.7.3)
Patch18: 0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
Patch18: 0001-Link-libnetsnmptrapd-against-MYSQL_LIBS.patch
Patch19: net-snmp-5.7.3-mariadb-connector-c.patch
Patch19: net-snmp-5.7.3-mariadb-connector-c.patch
# This patch fix issue with new OpenSLL library in rawhide (f26+)
# !!!WARNING!!! DO NOT USE IT FOR OLDER FEDORA RELEASES (>f26)
Patch100: net-snmp-5.7.3-openssl.patch
Patch100: net-snmp-5.7.3-openssl.patch
# Modern RPM API means at least EL6
Patch101: net-snmp-5.7.3-modern-rpm-api.patch
Patch101: net-snmp-5.7.3-modern-rpm-api.patch
Requires(post): chkconfig
Requires(preun): chkconfig
# for /sbin/service
Requires(preun): initscripts
# for /bin/rm
Requires(preun): coreutils
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
# 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
%{?systemd_requires}
BuildRequires: systemd
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps
BuildRequires: python2-devel, python2-setuptools
BuildRequires: chrpath
BuildRequires: mariadb-connector-c-devel
BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
BuildRequires: perl-devel, perl(ExtUtils::Embed), procps
BuildRequires: python2-devel, python2-setuptools
BuildRequires: chrpath
BuildRequires: mariadb-connector-c-devel
# for netstat, needed by 'make test'
BuildRequires: net-tools
BuildRequires: net-tools
# for make test
BuildRequires: perl(TAP::Harness)
BuildRequires: systemd-units
BuildRequires: perl(TAP::Harness)
%ifnarch s390 s390x ppc64le
BuildRequires: lm_sensors-devel >= 3
BuildRequires: lm_sensors-devel >= 3
%endif
BuildRequires: autoconf, automake
BuildRequires: autoconf, automake
%description
SNMP (Simple Network Management Protocol) is a protocol used for
@ -112,8 +103,7 @@ You will probably also want to install the net-snmp-utils package,
which contains NET-SNMP utilities.
%package utils
Group: Applications/System
Summary: Network management utilities using SNMP, from the NET-SNMP project
Summary: Network management utilities using SNMP, from the NET-SNMP project
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
%description utils
@ -125,8 +115,7 @@ using the SNMP protocol. You will also need to install the net-snmp
package.
%package devel
Group: Development/Libraries
Summary: The development environment for the NET-SNMP project
Summary: The development environment for the NET-SNMP project
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: elfutils-devel, rpm-devel, elfutils-libelf-devel, openssl-devel
@ -147,10 +136,9 @@ tools. You'll also need to have the net-snmp and net-snmp-utils
packages installed.
%package perl
Group: Development/Libraries
Summary: The perl NET-SNMP module and the mib2c tool
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}, perl-interpreter
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
Summary: The perl NET-SNMP module and the mib2c tool
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}, perl-interpreter
Requires: %{name}-agent-libs%{?_isa} = %{epoch}:%{version}-%{release}
BuildRequires: perl-interpreter
BuildRequires: perl-generators
@ -162,8 +150,7 @@ Install the net-snmp-perl package, if you want to use mib2c or SNMP
with perl.
%package gui
Group: Applications/System
Summary: An interactive graphical MIB browser for SNMP
Summary: An interactive graphical MIB browser for SNMP
Requires: perl-Tk, net-snmp-perl%{?_isa} = %{epoch}:%{version}-%{release}
%description gui
@ -175,7 +162,6 @@ the remote agents interactively.
Install the net-snmp-gui package, if you want to use this interactive utility.
%package libs
Group: Development/Libraries
Summary: The NET-SNMP runtime client libraries
%description libs
@ -183,11 +169,10 @@ The net-snmp-libs package contains the runtime client libraries for shared
binaries and applications.
%package agent-libs
Group: Development/Libraries
Summary: The NET-SNMP runtime agent libraries
Summary: The NET-SNMP runtime agent libraries
# the libs link against libperl.so:
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
%description agent-libs
The net-snmp-agent-libs package contains the runtime agent libraries for shared
@ -196,31 +181,20 @@ binaries and applications.
%package -n python2-net-snmp
%{?python_provide:%python_provide python2-net-snmp}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Group: Development/Libraries
Summary: The Python 'netsnmp' module for the Net-SNMP
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
Summary: The Python 'netsnmp' module for the Net-SNMP
Requires: %{name}-libs%{?_isa} = %{epoch}:%{version}-%{release}
%description -n python2-net-snmp
The 'netsnmp' module provides a full featured, tri-lingual SNMP (SNMPv3,
SNMPv2c, SNMPv1) client API. The 'netsnmp' module internals rely on the
Net-SNMP toolkit library.
%if 0%{?fedora} < 23
%package sysvinit
Group: System Environment/Daemons
Summary: Legacy SysV init scripts for Net-SNMP daemons
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%description sysvinit
The net-snmp-sysvinit package provides SysV init scripts for Net-SNMP daemons.
%endif
%prep
%setup -q
cp %{SOURCE12} .
cp %{SOURCE10} .
%ifnarch ia64
%patch1 -p1 -b .pie
@ -310,13 +284,13 @@ find perl/blib -type f -name "*.so" -print -exec chrpath --delete {} \;
# compile python module
pushd python
%{__python} setup.py --basedir="../" build
%{__python2} setup.py --basedir="../" build
popd
%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT}
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}
# Determine which arch net-snmp-config.h is going to try to #include.
basearch=%{_arch}
@ -328,44 +302,38 @@ basearch=i386
# Do an net-snmp-config.h switcheroo to avoid file conflicts on systems where you
# can have both a 32- and 64-bit version of the library, as they each need
# their own correct-but-different versions of net-snmp-config.h to be usable.
mv ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config-${basearch}
install -m 755 %SOURCE5 ${RPM_BUILD_ROOT}/%{_bindir}/net-snmp-config
mv ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config-${basearch}.h
install -m644 %SOURCE4 ${RPM_BUILD_ROOT}/%{_includedir}/net-snmp/net-snmp-config.h
mv %{buildroot}/%{_bindir}/net-snmp-config %{buildroot}/%{_bindir}/net-snmp-config-${basearch}
install -m 755 %SOURCE3 %{buildroot}/%{_bindir}/net-snmp-config
mv %{buildroot}/%{_includedir}/net-snmp/net-snmp-config.h %{buildroot}/%{_includedir}/net-snmp/net-snmp-config-${basearch}.h
install -m644 %SOURCE2 %{buildroot}/%{_includedir}/net-snmp/net-snmp-config.h
%endif
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp
install -m 644 %SOURCE1 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmpd.conf
install -m 644 %SOURCE6 ${RPM_BUILD_ROOT}%{_sysconfdir}/snmp/snmptrapd.conf
install -d %{buildroot}%{_sysconfdir}/snmp
install -m 644 %SOURCE1 %{buildroot}%{_sysconfdir}/snmp/snmpd.conf
install -m 644 %SOURCE4 %{buildroot}%{_sysconfdir}/snmp/snmptrapd.conf
%if 0%{?fedora} < 23
install -d ${RPM_BUILD_ROOT}%{_initrddir}
install -m 755 %SOURCE2 ${RPM_BUILD_ROOT}%{_initrddir}/snmpd
install -m 755 %SOURCE3 ${RPM_BUILD_ROOT}%{_initrddir}/snmptrapd
%endif
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
install -m 644 %SOURCE7 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmpd
install -m 644 %SOURCE8 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/snmptrapd
install -d %{buildroot}%{_sysconfdir}/sysconfig
install -m 644 %SOURCE5 %{buildroot}%{_sysconfdir}/sysconfig/snmpd
install -m 644 %SOURCE6 %{buildroot}%{_sysconfdir}/sysconfig/snmptrapd
# prepare /var/lib/net-snmp
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/lib/net-snmp
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/lib/net-snmp/mib_indexes
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/lib/net-snmp/cert_indexes
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/run/net-snmp
install -d %{buildroot}%{_localstatedir}/lib/net-snmp
install -d %{buildroot}%{_localstatedir}/lib/net-snmp/mib_indexes
install -d %{buildroot}%{_localstatedir}/lib/net-snmp/cert_indexes
install -d %{buildroot}%{_localstatedir}/run/net-snmp
# remove things we don't want to distribute
rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpinform
ln -s snmptrap ${RPM_BUILD_ROOT}/usr/bin/snmpinform
rm -f ${RPM_BUILD_ROOT}%{_bindir}/snmpcheck
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/fixproc
rm -f ${RPM_BUILD_ROOT}/%{_mandir}/man1/fixproc*
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/ipf-mod.pl
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/*.la
rm -f ${RPM_BUILD_ROOT}/%{_libdir}/libsnmp*
rm -f %{buildroot}%{_bindir}/snmpinform
ln -s snmptrap %{buildroot}/usr/bin/snmpinform
rm -f %{buildroot}%{_bindir}/snmpcheck
rm -f %{buildroot}/%{_bindir}/fixproc
rm -f %{buildroot}/%{_mandir}/man1/fixproc*
rm -f %{buildroot}/%{_bindir}/ipf-mod.pl
rm -f %{buildroot}/%{_libdir}/*.la
rm -f %{buildroot}/%{_libdir}/libsnmp*
# remove special perl files
find $RPM_BUILD_ROOT -name perllocal.pod \
find %{buildroot} -name perllocal.pod \
-o -name .packlist \
-o -name "*.bs" \
-o -name Makefile.subs.pl \
@ -374,14 +342,14 @@ find $RPM_BUILD_ROOT -name perllocal.pod \
rm -f README.aix README.hpux11 README.osX README.Panasonic_AM3X.txt README.solaris README.win32
# copy missing mib2c.conf files
install -m 644 local/mib2c.*.conf ${RPM_BUILD_ROOT}%{_datadir}/snmp
install -m 644 local/mib2c.*.conf %{buildroot}%{_datadir}/snmp
# install python module
pushd python
%{__python} setup.py --basedir=.. install -O1 --skip-build --root $RPM_BUILD_ROOT
%{__python2} setup.py --basedir=.. install -O1 --skip-build --root %{buildroot}
popd
find $RPM_BUILD_ROOT -name '*.so' | xargs chmod 0755
find %{buildroot} -name '*.so' | xargs chmod 0755
# trim down massive ChangeLog
dd bs=1024 count=250 if=ChangeLog of=ChangeLog.trimmed
@ -396,14 +364,14 @@ done
chmod 644 local/passtest local/ipf-mod.pl
# dirty hack for #603243, until it's fixed properly upstream
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
install -m 755 -d %{buildroot}/usr/include/net-snmp/agent/util_funcs
install -m 644 agent/mibgroup/util_funcs/*.h %{buildroot}/usr/include/net-snmp/agent/util_funcs
# systemd stuff
install -m 755 -d $RPM_BUILD_ROOT/%{_tmpfilesdir}
install -m 644 %SOURCE9 $RPM_BUILD_ROOT/%{_tmpfilesdir}/net-snmp.conf
install -m 755 -d $RPM_BUILD_ROOT/%{_unitdir}
install -m 644 %SOURCE10 %SOURCE11 $RPM_BUILD_ROOT/%{_unitdir}/
install -m 755 -d %{buildroot}/%{_tmpfilesdir}
install -m 644 %SOURCE7 %{buildroot}/%{_tmpfilesdir}/net-snmp.conf
install -m 755 -d %{buildroot}/%{_unitdir}
install -m 644 %SOURCE8 %SOURCE9 %{buildroot}/%{_unitdir}/
%check
%if %{netsnmp_check}
@ -415,7 +383,7 @@ cp -f libtool.orig libtool
# temporary workaround to make test "extending agent functionality with pass" working
chmod 755 local/passtest
LD_LIBRARY_PATH=${RPM_BUILD_ROOT}/%{_libdir} make test
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} make test
%endif
@ -429,36 +397,12 @@ LD_LIBRARY_PATH=${RPM_BUILD_ROOT}/%{_libdir} make test
%postun
%systemd_postun_with_restart snmpd.service snmptrapd.service
%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
/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 || :
%if 0%{?fedora} < 23
%triggerpostun -n net-snmp-sysvinit -- net-snmp < 1:5.7-5
/sbin/chkconfig --add snmpd >/dev/null 2>&1 || :
/sbin/chkconfig --add snmptrapd >/dev/null 2>&1 || :
%endif
%post libs -p /sbin/ldconfig
%postun libs -p /sbin/ldconfig
%post agent-libs -p /sbin/ldconfig
%postun agent-libs -p /sbin/ldconfig
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%doc COPYING ChangeLog.trimmed EXAMPLE.conf FAQ NEWS TODO
%doc README README.agent-mibs README.agentx README.krb5 README.snmpv3
@ -520,7 +464,7 @@ rm -rf ${RPM_BUILD_ROOT}
%files -n python2-net-snmp
%doc README
%{python_sitearch}/*
%{python2_sitearch}/*
%files gui
%{_bindir}/tkmib
@ -543,13 +487,12 @@ rm -rf ${RPM_BUILD_ROOT}
%{_libdir}/libnetsnmpmibs*.so.*
%{_libdir}/libnetsnmptrapd*.so.*
%if 0%{?fedora} < 23
%files sysvinit
%{_initrddir}/snmpd
%{_initrddir}/snmptrapd
%endif
%changelog
* Wed Jan 31 2018 Josef Ridky <jridky@redhat.com> - 1:5.7.3-30
- remove Group tag
- remove sysvinit package and init files (no longer needed)
- fix python2 references and dependencies in spec file
* Sat Jan 20 2018 Björn Esser <besser82@fedoraproject.org> - 1:5.7.3-29
- Rebuilt for switch to libxcrypt

View File

@ -1,115 +0,0 @@
#!/bin/bash
# ucd-snmp init file for snmpd
#
# chkconfig: - 50 50
# description: Simple Network Management Protocol (SNMP) Daemon
#
# processname: /usr/sbin/snmpd
# config: /etc/snmp/snmpd.conf
# config: /usr/share/snmp/snmpd.conf
# pidfile: /var/run/snmpd.pid
### BEGIN INIT INFO
# Provides: snmpd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: start and stop Net-SNMP daemon
# Description: Simple Network Management Protocol (SNMP) Daemon
### END INIT INFO
# source function library
. /etc/init.d/functions
OPTIONS="-LS0-6d -Lf /dev/null -p /var/run/snmpd.pid"
if [ -e /etc/sysconfig/snmpd ]; then
. /etc/sysconfig/snmpd
fi
RETVAL=0
prog="snmpd"
binary=/usr/sbin/snmpd
pidfile=/var/run/snmpd.pid
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
daemon --pidfile=$pidfile $binary $OPTIONS
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/snmpd
fi;
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
if [ $UID -ne 0 ]; then
RETVAL=1
failure
else
killproc -p $pidfile $binary
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snmpd
fi;
echo
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc -p $pidfile $binary -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/snmpd ] && restart
return 0
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload|force-reload)
reload
RETVAL=$?
;;
condrestart|try-restart)
condrestart
RETVAL=$?
;;
status)
status snmpd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
RETVAL=2
esac
exit $RETVAL

View File

@ -1,103 +0,0 @@
#!/bin/bash
# ucd-snmp init file for snmptrapd
#
# chkconfig: - 50 50
# description: Simple Network Management Protocol (SNMP) Trap Daemon
#
# processname: /usr/sbin/snmptrapd
# config: /etc/snmp/snmptrapd.conf
# config: /usr/share/snmp/snmptrapd.conf
# pidfile: /var/run/snmptrapd.pid
### BEGIN INIT INFO
# Provides: snmptrapd
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: start and stop Net-SNMP trap daemon
# Description: Simple Network Management Protocol (SNMP) trap daemon
### END INIT INFO
# source function library
. /etc/init.d/functions
OPTIONS="-Lsd -p /var/run/snmptrapd.pid"
if [ -e /etc/sysconfig/snmptrapd ]; then
. /etc/sysconfig/snmptrapd
fi
RETVAL=0
prog="snmptrapd"
binary=/usr/sbin/snmptrapd
pidfile=/var/run/snmptrapd.pid
start() {
[ -x $binary ] || exit 5
echo -n $"Starting $prog: "
daemon --pidfile=$pidfile /usr/sbin/snmptrapd $OPTIONS
RETVAL=$?
echo
touch /var/lock/subsys/snmptrapd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $pidfile /usr/sbin/snmptrapd
RETVAL=$?
echo
rm -f /var/lock/subsys/snmptrapd
return $RETVAL
}
reload(){
stop
start
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/snmptrapd ] && restart
return 0
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload|force-reload)
reload
RETVAL=$?
;;
condrestart|try-restart)
condrestart
RETVAL=$?
;;
status)
status snmptrapd
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
RETVAL=2
esac
exit $RETVAL