This commit is contained in:
Brian Zalewski 2023-06-15 02:40:58 +00:00
parent 9ba8da9f26
commit c6c40e1790

View file

@ -16,11 +16,21 @@
### System upgrade on macOS
if [ -d /Applications ] && [ -d /Library ]; then
sudo softwareupdate -i -a
if command -v gtimeout > /dev/null; then
# Allow 8 minutes for system updates
logg info 'Ensuring system software is upgraded (timing out after 8 minutes if system upgrade fails)'
sudo gtimeout 480 softwareupdate -i -a || logg warn 'The system update command timed out after 8 minutes'
else
# If gtimeout is unavailable, then attempt system upgrade without a timeout (which usually works on fresh systems)
logg info 'Applying OS upgrades (if available)'
sudo softwareupdate -i -a || logg error 'Failed to perform a system update via `sudo softwareupdate -i -a`'
fi
logg info 'If system updates were downloaded / installed, a reboot might be required.'
fi
### Install Xcode CLI tools on macOS
if [ -d /Applications ] && [ -d /Library ]; then
logg info 'Ensuring xcode-select is installed for developer tools'
xcode-select -p >/dev/null 2>&1 || sudo xcode-select --install
fi