From 100f0f9db9a622143152e9463a082ac350d33900 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Tue, 10 Dec 2019 00:37:06 +0100 Subject: [PATCH] Update with new sequencer features --- seqs/snmp.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/seqs/snmp.sh b/seqs/snmp.sh index 2470c94..dc1e2b5 100755 --- a/seqs/snmp.sh +++ b/seqs/snmp.sh @@ -15,8 +15,7 @@ step_1() { else exe apt install $toolName fi - saveReturn $? - endReturn + endReturn -o $? "$toolName installation failed" } step_2_info() { echo "Setup snmp v3 access"; } @@ -24,11 +23,10 @@ step_2() { # ## Create authentication entry exep "cat \"$v3AuthLoc\" | grep -e '^\s*usmUser'" - if [ "$?" == "0" ]; then echo - read -p "User entry found. Continue: y/n(default)? " answer + exe read -p "User entry found. Continue: y/n(default)? " answer case $answer in [yY]) echo @@ -64,11 +62,13 @@ step_2() { # ## Write syslocation - read -p "sysLocation: " v3Location - read -p "sysContact (name ): " v3Contact + exe read -p "sysLocation: " v3Location + exe read -p "sysContact (name ): " v3Contact exe sed -i "s/\(sysLocation\s*\).*/\1${v3Location}/" "$toolConfig" exe sed -i "s/\(sysContact\s*\).*/\1${v3Contact}/" "$toolConfig" + + exe service snmpd start } v3AuthLoc="/var/lib/snmp/snmpd.conf" @@ -81,8 +81,7 @@ step_20() { fi exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/raspberry.sh -O "${rpiExtendLoc}" - saveReturn $? - endReturn + endReturn -o $? "Download failed" exe chmod +x "$rpiExtendLoc" addConf -a "extend raspberry /etc/snmp/raspberry.sh" "$toolConfig" @@ -93,8 +92,8 @@ step_20() { rpiExtendLoc="${toolConfigLoc}/raspberry.sh" rpiSudoersLoc="/etc/sudoers.d/snmprpi" -rpiSudoersContent="\ - Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*" +rpiSudoersContent=" +Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*" step_22_info() { echo "Extend $toolName with OS update availablity"; } step_22_alias() { ALIAS="osupdate"; } @@ -105,6 +104,7 @@ step_22() { fi exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/osupdate -O "${osUpdateExtendLoc}" + endReturn -o $? "Download failed" exe chmod +x "$osUpdateExtendLoc" addConf -a "extend osupdate $osUpdateExtendLoc" "$toolConfig" @@ -142,5 +142,5 @@ checkExtend() { return 0 } -VERSION_SEQREV=5 +VERSION_SEQREV=7 . sequencer.sh