-
Notifications
You must be signed in to change notification settings - Fork 2
/
auto-update
executable file
·60 lines (50 loc) · 1.74 KB
/
auto-update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
#
# Mac OS X Automated Homebrew Cask Updater for Applications
#
# Copyright 2016 - Bryan R. Hoffpauir, Jr.
#
# http://stackoverflow.com/questions/31968664/upgrade-all-the-casks-installed-via-homebrew-cask
# Option 1 - Just check for updates and blast every cask that needs new updates
# use xargs so that the output of the first command is used as args and not stdin
# brew cask list | xargs brew cask install --force
# Option 2 - Require some review & provide option to exit after gracefully uninstalling packages before installing updates
# brew_cask_upgrade() {
# if [ "$1" != '--continue' ]; then
# echo "Removing brew cache"
# rm -rf "$(brew --cache)"
# echo "Running brew update"
# brew update
# fi
# for c in $(brew cask list); do
# echo -e "\n\nInstalled versions of $c: "
# ls /opt/homebrew-cask/Caskroom/$c
# echo "Cask info for $c"
# brew cask info $c
# select ynx in "Yes" "No" "Exit"; do
# case $ynx in
# "Yes") echo "Uninstalling $c"; brew cask uninstall --force "$c"; echo "Re-installing $c"; brew cask install "$c"; break;;
# "No") echo "Skipping $c"; break;;
# "Exit") echo "Exiting brew-cask-upgrade"; return;;
# esac
# done
# done
#}
# Note - this is commented out, uncomment it to run!
#brew_cask_upgrade
# Or option 3 - BJH Custom Method
# Update ALL THE THINGS
strict_update() {
brew update && \
brew prune && \
brew doctor && \
brew upgrade && \
brew cleanup && \
mas upgrade && \
brew cu --yes --no-brew-update --cleanup && \
sudo softwareupdate -i -a -v && \
sudo tmutil disablelocal \
brew bundle dump --force --global
git commit ~/.Brewfile -m "Updated brewfile after automatically running brew cask upgrade script."
}
strict_update