several improvement and armonisation in filefct.sh, module auth and patch_snmp improved

This commit is contained in:
2022-01-27 13:17:56 +01:00
parent baac34cb85
commit 55a9e49101
16 changed files with 204 additions and 116 deletions

View File

@@ -8,22 +8,25 @@
# https://opensource.org/licenses/BSD-3-Clause
# ------------------------------------------------------------------------------
export VER_patch_snmp="0.0.3"
export VER_patch_snmp="0.1.0"
export DEP_patch_snmp="install_pkg"
patch_snmp()
{
pkginst snmpd
backupdist /etc/snmp/snmpd.conf /etc/default/snmpd \
backup_dist /etc/snmp/snmpd.conf /etc/default/snmpd \
/lib/systemd/system/snmpd.service /etc/init.d/snmpd
installfile snmpd/snmpd.conf /etc/snmp/snmpd.conf
install_file 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 [[ ($SYS_DIST == 'debian' && $SYS_VER -lt 11) ||
($SYS_DIST == 'devuan' && $SYS_VER -lt 4) ]]; then
install_file snmpd/snmpd.init /etc/init.d/snmpd
fi
install_file snmpd/snmpd.default /etc/default/snmpd
tag_file /etc/default/snmpd
if [[ -e /lib/systemd/system/snmpd.service ]]; then
installfile snmpd/snmpd.service /lib/systemd/system/snmpd.service
install_file snmpd/snmpd.service /lib/systemd/system/snmpd.service
if command -v systemctl &> /dev/null; then
systemctl daemon-reload
fi
@@ -33,9 +36,9 @@ patch_snmp()
precheck_patch_snmp()
{
file_exists snmpd/snmpd.{conf,default}
file_must_exists snmpd/snmpd.{conf,default}
if [[ -e /lib/systemd/system/snmpd.service ]]; then
file_exists snmpd/snmpd.service
file_must_exists snmpd/snmpd.service
fi
}