This commit is contained in:
Brian Zalewski 2023-11-30 04:38:03 +00:00
parent fed4440189
commit 6f08d24dde

View file

@ -30,17 +30,19 @@
### System upgrade on macOS
# Note: If a shutdown is required and the `softwareupdate` command restart command does not work then `m shutdown -f` might be useful or `m restart -f`
# Do you want to terminate running processes in this window?
# Closing this window will terminate the running processes: softwareupdate, sudo
if [ -d /Applications ] && [ -d /Library ] && [ -z "$NO_RESTART" ]; then
if [ ! -f "$HOME/.zshrc" ] || ! cat "$HOME/.zshrc" | grep '# TEMPORARY FOR INSTALL DOCTOR MACOS' > /dev/null; then
echo 'bash <(curl -sSL https://install.doctor/start) # TEMPORARY FOR INSTALL DOCTOR MACOS' >> "$HOME/.zshrc"
fi
if command -v gtimeout > /dev/null; then
logg info 'Ensuring system software is upgraded (timing out after 50 minutes if system upgrade fails)'
sudo gtimeout 3000 softwareupdate -i -a -R || logg warn 'The system update command timed out after 50 minutes'
sudo gtimeout 3000 softwareupdate -i -a -R --agree-to-license || logg warn 'The system update command timed out after 50 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 -R || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R'
sudo softwareupdate -i -a -R --agree-to-license || logg error 'Failed to perform a system update via sudo softwareupdate -i -a -R'
fi
logg info 'If system updates were downloaded / installed, a reboot might be required.'
if command -v gsed > /dev/null; then