From c6c40e17909411bfe9da8ad6995dacb3e0403758 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Thu, 15 Jun 2023 02:40:58 +0000 Subject: [PATCH] Latest --- .../universal/run_before_01-system-homebrew.sh.tmpl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl b/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl index 5bf9fc24..8307e9bc 100644 --- a/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl +++ b/home/.chezmoiscripts/universal/run_before_01-system-homebrew.sh.tmpl @@ -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