-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrew-update
executable file
·53 lines (34 loc) · 1.08 KB
/
brew-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
#!/bin/bash
# Update the last loaded date....
if [[ -d "$TMPDIR" ]] ; then
cd $TMPDIR
fi
set -euo pipefail
update_path="$HOME/Library/Application Support/Homebrew"
mkdir -p "${update_path}"
last_update="${update_path}/last_update.txt"
touch "$last_update"
echo Brew previous updated at $(cat "$last_update").
sleep 2
echo "----- Updating... -----"
brew update
echo -e 'upgrading in 3...' && sleep 1
echo -e 'upgrading in 2...' && sleep 1
echo -e 'upgrading in 1...' && sleep 1
echo "----- Upgrading... -----"
brew -v upgrade
echo ----- Cleanup old installs -----
brew cleanup
# htop needs root permissions to work properly and I prefer this method to
# using sudo every time I run htop.
htop_path=/opt/homebrew/bin/htop
if [ ! -u $htop_path ] ; then
echo "Need to chmod htop binary: sudo will happen next, so expect a prompt"
sudo chmod -v u+s $htop_path
fi
if [ -O $htop_path ] ; then
echo "Need to chown htop binary: sudo will happen next."
sudo chown -v root $htop_path
fi
echo $(date) > "${last_update}"
echo Brew updated as of $(cat "$last_update").