32 lines
1.1 KiB
Bash
Executable file
32 lines
1.1 KiB
Bash
Executable file
#!/bin/sh
|
|
# shellcheck disable=SC1091
|
|
|
|
release_version=$(cat /etc/debian_version)
|
|
release_codename=$(. /etc/os-release; echo "$VERSION_CODENAME" | sed 's/^[a-z]/\U&/g')
|
|
|
|
sudo /usr/bin/apt-get update -qq
|
|
|
|
echo "apt debian_release=\"$release_version\""
|
|
|
|
|
|
updates_regular=$(apt-get -qq -y --ignore-hold --allow-change-held-packages --allow-unauthenticated -s dist-upgrade | grep ^Inst | grep -c -v Security)
|
|
updates_security=$(apt-get -qq -y --ignore-hold --allow-change-held-packages --allow-unauthenticated -s dist-upgrade | grep ^Inst | grep -c Security)
|
|
updates_packages=$(apt-get -qq -y --ignore-hold --allow-change-held-packages --allow-unauthenticated -s dist-upgrade | grep ^Inst | cut -d ' ' -f 2 | paste -s -d " ")
|
|
|
|
if [ "$updates_security" -gt 0 ] && [ "$updates_regular" -gt 0 ]; then
|
|
updates_severity=3
|
|
elif [ "$updates_security" -gt 0 ]; then
|
|
updates_severity=2
|
|
elif [ "$updates_regular" -gt 0 ]; then
|
|
updates_severity=1
|
|
else
|
|
updates_severity=0
|
|
fi
|
|
|
|
echo "apt updates_regular=$updates_regular"
|
|
echo "apt updates_security=$updates_security"
|
|
echo "apt updates_severity=$((updates_severity))"
|
|
|
|
|
|
|
|
|