Closed jfuchtm closed 5 years ago
Sure, here you go. I'm not adding it to the main script though.
#!/bin/bash
# Check for macOS version
osvers=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}')
# Enable automatic download and install of system updates
# for OS X Yosemite and later.
plist_file="/Library/Preferences/com.apple.SoftwareUpdate.plist"
# Enable the following:
#
# Automatic background check for macOS software updates
# Automatic download of macOS software updates
# Automatic download and installation of XProtect, MRT and Gatekeeper updates
# Automatic download and installation of automatic security updates
/usr/bin/defaults write "$plist_file" AutomaticCheckEnabled -bool true
/usr/bin/defaults write "$plist_file" AutomaticDownload -bool true
/usr/bin/defaults write "$plist_file" ConfigDataInstall -bool true
/usr/bin/defaults write "$plist_file" CriticalUpdateInstall -bool true
# For macOS Mojave and later, enable the automatic installation of macOS updates.
if [[ "$osvers" -ge 14 ]]; then
/usr/bin/defaults write "$plist_file" AutomaticallyInstallMacOSUpdates -bool true
fi
# For OS X Yosemite through macOS High Sierra, enable the automatic installation
# of OS X and macOS updates.
plist_file="/Library/Preferences/com.apple.commerce.plist"
if [[ "$osvers" -ge 12 ]] && [[ "$osvers" -lt 14 ]]; then
/usr/bin/defaults write "$plist_file" AutoUpdateRestartRequired -bool true
fi
# For OS X Yosemite and later, enable the automatic installation of App Store updates
if [[ "$osvers" -ge 10 ]]; then
/usr/bin/defaults write "$plist_file" AutoUpdate -bool true
fi
Thank you very much!
Jeff Uchtman
District Network & Systems Administrator
Columbus Public Schools
2508 27th Street
Columbus, NE 68601
402-563-7000 ext. 12352
uchtmanj@discoverers.org
In God we trust, all others we virus scan. ~Author Unknown
From: rtrouton notifications@github.com Reply-To: rtrouton/rtrouton_scripts reply@reply.github.com Date: Friday, May 17, 2019 at 12:52 PM To: rtrouton/rtrouton_scripts rtrouton_scripts@noreply.github.com Cc: Jeff Uchtman uchtmanj@discoverers.org, Author author@noreply.github.com Subject: Re: [rtrouton/rtrouton_scripts] App Updates (#61)
osvers=$(/usr/bin/sw_vers -productVersion | awk -F. '{print $2}')
plist_file="/Library/Preferences/com.apple.SoftwareUpdate.plist"
#
/usr/bin/defaults write "$plist_file" AutomaticCheckEnabled -bool true /usr/bin/defaults write "$plist_file" AutomaticDownload -bool true /usr/bin/defaults write "$plist_file" ConfigDataInstall -bool true /usr/bin/defaults write "$plist_file" CriticalUpdateInstall -bool true
if [[ "$osvers" -ge 14 ]]; then /usr/bin/defaults write "$plist_file" AutomaticallyInstallMacOSUpdates -bool true fi
plist_file="/Library/Preferences/com.apple.commerce.plist"
if [[ "$osvers" -ge 12 ]] && [[ "$osvers" -lt 14 ]]; then /usr/bin/defaults write "$plist_file" AutoUpdateRestartRequired -bool true fi
if [[ "$osvers" -ge 10 ]]; then /usr/bin/defaults write "$plist_file" AutoUpdate -bool true fi
Can you add the tick box on Mojave for "Install app updates from App Store"?