#!/bin/sh

#
# append the control line to activate our trap handler
#
SNMPTRAPDCONF=/etc/snmp/snmptrapd.conf
DEFLINE="traphandle default /usr/sbin/snmptrapfmthdlr"

/bin/grep -qs "${DEFLINE}" ${SNMPTRAPDCONF}
if [ $? -eq 1 ]; then
  # line not there, append it
    echo "${DEFLINE}"  >> ${SNMPTRAPDCONF}

  #
  # restart the snmpd and snmptrapd
  #
  /etc/init.d/snmpd restart
fi

# Automatically added by dh_installinit
if [ -x "/etc/init.d/snmptrapfmt" ]; then
	update-rc.d snmptrapfmt defaults >/dev/null
	if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
		invoke-rc.d snmptrapfmt start || exit $?
	else
		/etc/init.d/snmptrapfmt start || exit $?
	fi
fi
# End automatically added section

