Files
init.sh/modules/patch_snmp.sh

46 lines
1.5 KiB
Bash

# ------------------------------------------------------------------------------
# SNMP monitoring conf
# This file is part of the init.sh project
# Copyright (c) 2019-2021 Geoffray Levasseur <fatalerrors@geoffray-levasseur.org>
# ------------------------------------------------------------------------------
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# https://opensource.org/licenses/BSD-3-Clause
# ------------------------------------------------------------------------------
export VER_patch_snmp="0.0.3"
export DEP_patch_snmp="install_pkg"
patch_snmp()
{
pkginst snmpd
backupdist /etc/snmp/snmpd.conf /etc/default/snmpd \
/lib/systemd/system/snmpd.service /etc/init.d/snmpd
installfile snmpd/snmpd.conf /etc/snmp/snmpd.conf
tagfile /etc/snmp/snmpd.conf
# No longer required with Debian >= 11 or Devuan >= 4
# installfile snmpd/snmpd.init /etc/init.d/snmpd
installfile snmpd/snmpd.default /etc/default/snmpd
tagfile /etc/default/snmpd
if [[ -e /lib/systemd/system/snmpd.service ]]; then
installfile snmpd/snmpd.service /lib/systemd/system/snmpd.service
if command -v systemctl &> /dev/null; then
systemctl daemon-reload
fi
fi
svc_restart snmpd
}
precheck_patch_snmp()
{
file_exists snmpd/snmpd.{conf,default}
if [[ -e /lib/systemd/system/snmpd.service ]]; then
file_exists snmpd/snmpd.service
fi
}
export -f patch_snmp
export -f precheck_patch_snmp
# EOF