-
Notifications
You must be signed in to change notification settings - Fork 2
/
update-prompt
executable file
·44 lines (40 loc) · 1.02 KB
/
update-prompt
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
#!/bin/sh
#
# Mac OS X Automated Installer Bash Profile Configuration
#
# Copyright 2016 - Bryan R. Hoffpauir, Jr.
#
# https://github.com/knitschmann/DeviceAutomization/blob/master/OSX/update.sh
fetch(){
echo "Removing brew cache"
rm -rf "$(brew --cache)"
echo "Running brew update"
brew update
}
lookup() {
for c in $(brew cask list); do
brew cask info $c
done
}
update(){
var=$( lookup | grep -B 3 'Not installed' | sed -e '/^http/d;/^Not/d;/:/!d' | cut -d ":" -f1)
if [ -n "$var" ]; then
echo "The following installed casks have updates avilable:"
echo "$var"
echo "Install updates now?"
select yn in "Yes" "No"; do
case $yn in
"Yes") echo "updating outdated casks"; break;;
"No") echo "brew cask upgrade cancelled" ;return;;
*) echo "Please choose 1 or 2";;
esac
done
for i in $var; do
echo "Uninstalling $c"; brew cask uninstall --force "$i"; echo "Re-installing $i"; brew cask install "$i"
done
else
echo "all casks are up to date"
fi
}
fetch
update