Update with new sequencer features

This commit is contained in:
2019-12-10 00:37:06 +01:00
parent 982d34815f
commit 100f0f9db9

View File

@@ -15,8 +15,7 @@ step_1() {
else else
exe apt install $toolName exe apt install $toolName
fi fi
saveReturn $? endReturn -o $? "$toolName installation failed"
endReturn
} }
step_2_info() { echo "Setup snmp v3 access"; } step_2_info() { echo "Setup snmp v3 access"; }
@@ -24,11 +23,10 @@ step_2() {
# #
## Create authentication entry ## Create authentication entry
exep "cat \"$v3AuthLoc\" | grep -e '^\s*usmUser'" exep "cat \"$v3AuthLoc\" | grep -e '^\s*usmUser'"
if [ "$?" == "0" ]; then if [ "$?" == "0" ]; then
echo 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 case $answer in
[yY]) [yY])
echo echo
@@ -64,11 +62,13 @@ step_2() {
# #
## Write syslocation ## Write syslocation
read -p "sysLocation: " v3Location exe read -p "sysLocation: " v3Location
read -p "sysContact (name <webmaster@example.com>): " v3Contact exe read -p "sysContact (name <webmaster@example.com>): " v3Contact
exe sed -i "s/\(sysLocation\s*\).*/\1${v3Location}/" "$toolConfig" exe sed -i "s/\(sysLocation\s*\).*/\1${v3Location}/" "$toolConfig"
exe sed -i "s/\(sysContact\s*\).*/\1${v3Contact}/" "$toolConfig" exe sed -i "s/\(sysContact\s*\).*/\1${v3Contact}/" "$toolConfig"
exe service snmpd start
} }
v3AuthLoc="/var/lib/snmp/snmpd.conf" v3AuthLoc="/var/lib/snmp/snmpd.conf"
@@ -81,8 +81,7 @@ step_20() {
fi fi
exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/raspberry.sh -O "${rpiExtendLoc}" exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/raspberry.sh -O "${rpiExtendLoc}"
saveReturn $? endReturn -o $? "Download failed"
endReturn
exe chmod +x "$rpiExtendLoc" exe chmod +x "$rpiExtendLoc"
addConf -a "extend raspberry /etc/snmp/raspberry.sh" "$toolConfig" addConf -a "extend raspberry /etc/snmp/raspberry.sh" "$toolConfig"
@@ -93,7 +92,7 @@ step_20() {
rpiExtendLoc="${toolConfigLoc}/raspberry.sh" rpiExtendLoc="${toolConfigLoc}/raspberry.sh"
rpiSudoersLoc="/etc/sudoers.d/snmprpi" rpiSudoersLoc="/etc/sudoers.d/snmprpi"
rpiSudoersContent="\ rpiSudoersContent="
Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*" Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*"
step_22_info() { echo "Extend $toolName with OS update availablity"; } step_22_info() { echo "Extend $toolName with OS update availablity"; }
@@ -105,6 +104,7 @@ step_22() {
fi fi
exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/osupdate -O "${osUpdateExtendLoc}" exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/osupdate -O "${osUpdateExtendLoc}"
endReturn -o $? "Download failed"
exe chmod +x "$osUpdateExtendLoc" exe chmod +x "$osUpdateExtendLoc"
addConf -a "extend osupdate $osUpdateExtendLoc" "$toolConfig" addConf -a "extend osupdate $osUpdateExtendLoc" "$toolConfig"
@@ -142,5 +142,5 @@ checkExtend() {
return 0 return 0
} }
VERSION_SEQREV=5 VERSION_SEQREV=7
. sequencer.sh . sequencer.sh