Skip to content
This repository has been archived by the owner on Sep 27, 2023. It is now read-only.

Commit

Permalink
Add enable_automatic_system_updates
Browse files Browse the repository at this point in the history
See #17
  • Loading branch information
0xmachos committed Jan 20, 2019
1 parent a45ad67 commit f6f2594
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Lockdown
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,20 @@ function full_disk_access_check {
### END UTILITY FUNCTIONS ###


function enable_automatic_updates {
function enable_automatic_system_updates {

local mode=${1:?No mode passed}
local title
local audit_command
local fix_command

title="Enable Automatic Updates"

audit_command="sudo softwareupdate --schedule | grep -q 'Automatic check is on'"
fix_command="sudo softwareupdate --schedule on"
title="Enable Automatic System Updates"

# shellcheck disable=SC2016
audit_command='if ! defaults read "/Library/Preferences/com.apple.SoftwareUpdate.plist" "AutomaticallyInstallMacOSUpdates" >/dev/null 2>&1; then exit 1; fi; defaults read "/Library/Preferences/com.apple.SoftwareUpdate.plist" AutomaticallyInstallMacOSUpdates | grep -q "1"'
# shellcheck disable=SC2016
fix_command='declare -a keys; keys=(AutomaticCheckEnabled AutomaticDownload AutomaticallyInstallMacOSUpdates ConfigDataInstall CriticalUpdateInstall); for key in "${keys[@]}"; do sudo defaults write "/Library/Preferences/com.apple.SoftwareUpdate.plist" "${key}" -bool true; done'

mode_check "${mode}" "${title}" "${audit_command}" "${fix_command}"
}

Expand Down Expand Up @@ -704,7 +706,7 @@ function main {
declare audit_setting_num
declare fix_setting_num

settings=(enable_automatic_updates enable_gatekeeper enable_firewall enable_admin_password_preferences \
settings=(enable_automatic_system_updates enable_gatekeeper enable_firewall enable_admin_password_preferences \
enable_terminal_secure_entry enable_sip enable_filevault \
disable_firewall_builin_software disable_firewall_downloaded_signed \
disable_ipv6 disable_mail_remote_content disable_remote_apple_events disable_remote_login \
Expand Down

0 comments on commit f6f2594

Please sign in to comment.