summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHideki Yamane <henrich@debian.org>2014-03-30 18:40:27 +0900
committerHideki Yamane <henrich@debian.org>2014-03-30 18:40:27 +0900
commit55e2523b6228ebb22127bab2b08427f115b95a27 (patch)
treec25865f0cc18445bb625e75f6c2eda245d6fba2f
parent73395eb57feeee19f3a5781e17b2341626be4b6e (diff)
downloadpkg-net-snmp-55e2523b6228ebb22127bab2b08427f115b95a27.tar.gz
split snmptrapd
-rw-r--r--debian/control13
-rw-r--r--debian/snmpd.default10
-rw-r--r--debian/snmpd.install5
-rw-r--r--debian/snmpd.lintian-overrides1
-rw-r--r--debian/snmpd.manpages3
-rw-r--r--debian/snmpd.postrm2
-rw-r--r--debian/snmptrapd.default9
-rw-r--r--debian/snmptrapd.dirs1
-rw-r--r--debian/snmptrapd.init107
-rw-r--r--debian/snmptrapd.install4
-rw-r--r--debian/snmptrapd.lintian-overrides1
-rw-r--r--debian/snmptrapd.manpages2
-rw-r--r--debian/snmptrapd.postrm12
13 files changed, 151 insertions, 19 deletions
diff --git a/debian/control b/debian/control
index 700960a..cc36f77 100644
--- a/debian/control
+++ b/debian/control
@@ -30,6 +30,19 @@ Description: SNMP (Simple Network Management Protocol) agents
The Net-SNMP agent is a daemon which listens for incoming SNMP
requests from clients and provides responses.
+Package: snmptrapd
+Architecture: any
+Recommends: perl-modules
+Depends: ${shlibs:Depends}, ${misc:Depends}, snmpd
+Breaks: snmpd (<< 5.7.2~dfsg-9)
+Description: SNMP (Simple Network Management Protocol)
+ The Simple Network Management Protocol (SNMP) provides a framework
+ for the exchange of management information between agents (servers)
+ and clients.
+ .
+ snmptrapd is an SNMP application that receives and logs SNMP TRAP and
+ INFORM messages.
+
Package: snmp
Architecture: any
Recommends: perl-modules
diff --git a/debian/snmpd.default b/debian/snmpd.default
index 0a21978..819c9a8 100644
--- a/debian/snmpd.default
+++ b/debian/snmpd.default
@@ -1,4 +1,4 @@
-# This file controls the activity of snmpd and snmptrapd
+# This file controls the activity of snmpd
# Don't load any MIBs by default.
# You might comment this lines once you have the MIBs downloaded.
@@ -9,11 +9,3 @@ SNMPDRUN=yes
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -g snmp -I -smux,mteTrigger,mteTriggerConf -p /var/run/snmpd.pid'
-
-# snmptrapd control (yes means start daemon). As of net-snmp version
-# 5.0, master agentx support must be enabled in snmpd before snmptrapd
-# can be run. See snmpd.conf(5) for how to do this.
-TRAPDRUN=no
-
-# snmptrapd options (use syslog).
-TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
diff --git a/debian/snmpd.install b/debian/snmpd.install
index 0080a68..869de98 100644
--- a/debian/snmpd.install
+++ b/debian/snmpd.install
@@ -1,6 +1,3 @@
-debian/snmptrapd.conf etc/snmp/
-usr/sbin/*
+usr/sbin/snmpd
usr/share/snmp/snmpconf-data/snmpd-data
-usr/share/snmp/snmpconf-data/snmptrapd-data
usr/share/snmp/snmp_perl.pl
-usr/share/snmp/snmp_perl_trapd.pl
diff --git a/debian/snmpd.lintian-overrides b/debian/snmpd.lintian-overrides
index 0784d73..8821a55 100644
--- a/debian/snmpd.lintian-overrides
+++ b/debian/snmpd.lintian-overrides
@@ -1,2 +1 @@
snmpd: non-standard-file-perm etc/snmp/snmpd.conf 0600 != 0644
-snmpd: non-standard-file-perm etc/snmp/snmptrapd.conf 0600 != 0644
diff --git a/debian/snmpd.manpages b/debian/snmpd.manpages
index ec2dace..4b51151 100644
--- a/debian/snmpd.manpages
+++ b/debian/snmpd.manpages
@@ -1,5 +1,2 @@
man/snmpd.conf.5
-man/snmptrapd.conf.5
man/snmpd.8
-man/snmptrapd.8
-
diff --git a/debian/snmpd.postrm b/debian/snmpd.postrm
index 9c4a37e..dddd4d0 100644
--- a/debian/snmpd.postrm
+++ b/debian/snmpd.postrm
@@ -6,10 +6,8 @@ set -e
if [ $1 = purge ]; then
rm -f /var/lib/snmp/snmpd.conf*
- rm -f /var/lib/snmp/snmptrapd.conf*
rm -rf /var/run/agentx
rm -f /var/run/snmpd.pid
- rm -f /var/run/snmptrapd.pid
if getent passwd snmp >/dev/null; then
if [ -x /usr/sbin/deluser ]; then
deluser --quiet --system snmp
diff --git a/debian/snmptrapd.default b/debian/snmptrapd.default
new file mode 100644
index 0000000..7c9f734
--- /dev/null
+++ b/debian/snmptrapd.default
@@ -0,0 +1,9 @@
+# This file controls the activity of snmptrapd
+
+# snmptrapd control (yes means start daemon). As of net-snmp version
+# 5.0, master agentx support must be enabled in snmpd before snmptrapd
+# can be run. See snmpd.conf(5) for how to do this.
+TRAPDRUN=no
+
+# snmptrapd options (use syslog).
+TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
diff --git a/debian/snmptrapd.dirs b/debian/snmptrapd.dirs
new file mode 100644
index 0000000..230a402
--- /dev/null
+++ b/debian/snmptrapd.dirs
@@ -0,0 +1 @@
+etc/snmp
diff --git a/debian/snmptrapd.init b/debian/snmptrapd.init
new file mode 100644
index 0000000..1c5b46a
--- /dev/null
+++ b/debian/snmptrapd.init
@@ -0,0 +1,107 @@
+#! /bin/sh -e
+### BEGIN INIT INFO
+# Provides: snmpd snmptrapd
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop: $network $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: SNMP agents
+# Description: NET SNMP (Simple Network Management Protocol) Agents
+### END INIT INFO
+#
+# Author: Jochen Friedrich <jochen@scram.de>
+#
+set -e
+
+. /lib/lsb/init-functions
+
+export PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+test -x /usr/sbin/snmpd || exit 0
+test -x /usr/sbin/snmptrapd || exit 0
+
+# Defaults
+OLD_MIBS_DIR="/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp"
+MIBS_DIR="/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf"
+export MIBDIRS="$MIBS_DIR:$OLD_MIBS_DIR"
+
+SNMP_PID="/run/snmpd.pid"
+TRAPD_PID="/run/snmptrapd.pid"
+SNMPDRUN="yes"
+SNMPDOPTS="-Lsd -Lf /dev/null -p $SNMP_PID"
+TRAPDRUN=no
+TRAPDOPTS="-Lsd -p $TRAPD_PID"
+
+# Reads config file (will override defaults above)
+[ -r /etc/default/snmpd ] && . /etc/default/snmpd
+
+# Cd to / before starting any daemons.
+cd /
+
+case "$1" in
+ start)
+ log_daemon_msg "Starting SNMP services:"
+ # remove old symlink with previous version
+ if [ -L /var/run/agentx ]; then
+ rm -f /var/run/agentx
+ fi
+ if [ ! -d /var/run/agentx ]; then
+ mkdir -p /var/run/agentx
+ fi
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmpd \
+ -- $SNMPDOPTS
+ log_progress_msg " snmpd"
+ fi
+ if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ start-stop-daemon --quiet --start --oknodo --exec /usr/sbin/snmptrapd \
+ -- $TRAPDOPTS
+ log_progress_msg " snmptrapd"
+ fi
+ ;;
+ stop)
+ log_daemon_msg "Stopping SNMP services:"
+ start-stop-daemon --quiet --stop --oknodo --exec --retry 3 /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+ log_progress_msg " snmpd"
+ start-stop-daemon --quiet --stop --oknodo --exec --retry 3 /usr/sbin/snmptrapd && [ ! -f $TRAPD_PID ] || rm $TRAPD_PID
+ log_progress_msg " snmptrapd"
+ ;;
+ restart)
+ log_daemon_msg "Restarting SNMP services:"
+ start-stop-daemon --quiet --stop --oknodo --exec --retry 3 /usr/sbin/snmpd && [ ! -f $SNMP_PID ] || rm $SNMP_PID
+ start-stop-daemon --quiet --stop --oknodo --exec --retry 3 /usr/sbin/snmptrapd && [ ! -f $TRAPD_PID ] || rm $TRAPD_PID
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ start-stop-daemon --quiet --start --exec /usr/sbin/snmpd -- $SNMPDOPTS
+ log_progress_msg " snmpd"
+ fi
+ if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ # Allow snmpd time to start up.
+ sleep 1
+ start-stop-daemon --quiet --start --exec /usr/sbin/snmptrapd -- $TRAPDOPTS
+ log_progress_msg " snmptrapd"
+ fi
+ ;;
+ reload|force-reload)
+ log_daemon_msg "Reloading SNMP services:"
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ start-stop-daemon --quiet --stop --signal 1 \
+ --pidfile /var/run/snmpd.pid --exec /usr/sbin/snmpd
+ log_progress_msg " snmpd"
+ fi
+ ;;
+ status)
+ status=0
+ if [ "$SNMPDRUN" = "yes" -a -f /etc/snmp/snmpd.conf ]; then
+ status_of_proc /usr/sbin/snmpd snmpd || status=$?
+ fi
+ if [ "$TRAPDRUN" = "yes" -a -f /etc/snmp/snmptrapd.conf ]; then
+ status_of_proc /usr/sbin/snmptrapd snmptrapd || status=$?
+ fi
+ exit $status
+ ;;
+ *)
+ echo "Usage: /etc/init.d/snmpd {start|stop|restart|reload|force-reload|status}"
+ exit 1
+esac
+
+exit 0
diff --git a/debian/snmptrapd.install b/debian/snmptrapd.install
new file mode 100644
index 0000000..4dead64
--- /dev/null
+++ b/debian/snmptrapd.install
@@ -0,0 +1,4 @@
+usr/sbin/snmptrapd
+debian/snmptrapd.conf etc/snmp/
+usr/share/snmp/snmpconf-data/snmptrapd-data
+usr/share/snmp/snmp_perl_trapd.pl
diff --git a/debian/snmptrapd.lintian-overrides b/debian/snmptrapd.lintian-overrides
new file mode 100644
index 0000000..82ce81c
--- /dev/null
+++ b/debian/snmptrapd.lintian-overrides
@@ -0,0 +1 @@
+snmpd: non-standard-file-perm etc/snmp/snmptrapd.conf 0600 != 0644
diff --git a/debian/snmptrapd.manpages b/debian/snmptrapd.manpages
new file mode 100644
index 0000000..ac0d7ab
--- /dev/null
+++ b/debian/snmptrapd.manpages
@@ -0,0 +1,2 @@
+man/snmptrapd.conf.5
+man/snmptrapd.8
diff --git a/debian/snmptrapd.postrm b/debian/snmptrapd.postrm
new file mode 100644
index 0000000..77deff7
--- /dev/null
+++ b/debian/snmptrapd.postrm
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+set -e
+
+#DEBHELPER#
+
+if [ $1 = purge ]; then
+ rm -f /var/lib/snmp/snmptrapd.conf*
+ rm -f /var/run/snmptrapd.pid
+fi
+
+exit 0