[#454] adopt enforcement framework + STATUS; modernize librenms agent scripts

check-rules green; shellcheck fixes to dpkg.sh/os-updates.sh (legacy
backticks, unquoted vars, array-quoted command builders); Discourse
pointers added to basis docs; awx/k8s/compliance repos referenced.
https://projects.knownelement.com/issues/454
This commit is contained in:
2026-09-05 05:35:44 -05:00
parent 2eccacd024
commit 962a8f197d
19 changed files with 829 additions and 53 deletions
+14 -10
View File
@@ -5,18 +5,22 @@
if [ -x /usr/bin/dpkg-query ]; then
DATE=$(date +%s)
FILE=/var/cache/librenms/agent-local-dpkg
[ -d /var/cache/librenms ] || mkdir -p /var/cache/librenms
if [ ! -e $FILE ]; then
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep " installed "|cut -d\ -f4- > $FILE
refresh() {
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n' \
| grep " installed " | cut -d\ -f4- > "$FILE"
}
if [ ! -e "$FILE" ]; then
refresh
fi
FILEMTIME=$(stat -c %Y $FILE)
FILEAGE=$(($DATE-$FILEMTIME))
if [ $FILEAGE -gt 1800 ]; then
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep " installed "|cut -d\ -f4- > $FILE
FILEMTIME=$(stat -c %Y "$FILE")
FILEAGE=$((DATE - FILEMTIME))
if [ "$FILEAGE" -gt 1800 ]; then
refresh
fi
echo "<<<dpkg>>>"
cat $FILE
cat "$FILE"
fi