Commit fcc93b29 authored by Peter Möller's avatar Peter Möller

Simplified testing of softwareupdate

parent 4fdab485
......@@ -101,8 +101,10 @@ else
fi
# Uptime
Uptime="$(python -c "print(float(($(date +%s)-$(sysctl -n kern.boottime | awk '{print $4}' | sed -e 's/,//'))/86400))" | cut -d\. -f1)"
# Get the available softwareupdates (if any). They take som time getting and we will use it twice
SoftwareUpdate="$(/usr/sbin/softwareupdate -l 2>/dev/null)"
# Restart required?
if [ -n "$(/usr/sbin/softwareupdate -l 2>/dev/null | egrep "restart")" ]; then
if [ -n "$(echo "$SoftwareUpdate" | egrep "restart")" ]; then
RebootRequired="Yes"
else
RebootRequired="No"
......@@ -112,7 +114,7 @@ fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Security patches
SecurityPatches="$(/usr/sbin/softwareupdate -l 2>/dev/null | egrep -i "Security" | cut -d: -f2 | cut -c2-)"
SecurityPatches="$(echo "$SoftwareUpdate" | egrep -i "Security" | cut -d: -f2 | cut -c2-)"
# Ex: SecurityPatches='macOS Catalina Security Update 2021-003-10.15.7'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment