-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·144 lines (129 loc) · 2.59 KB
/
install.sh
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
source 'helpers.sh'
echo ""
echo_header "Starting installation"
# Ask for the admin password upfront, and run a keep-alive to
# update the `sudo` timestamp until the script has finished.
sudo -v
while true; do
sudo -n true
sleep 60
kill -0 "$$" || exit
done 2>/dev/null &
# Check for Homebrew. Install if needed.
if test ! $(which brew); then
echo_item "Installing homebrew" "green"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >>/Users/$USER/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
echo_item "Tapping additional homebrew repositories" "green"
brew tap FelixKratz/formulae
echo_item "Updating homebrew" "green"
brew update
brew upgrade
# These are the packages we want to have installed
WANTED_PACKAGES=(
awscli
borders
btop
coreutils
direnv
dive
dockutil
efm-langserver
flyctl
fzf
git-crypt
git-lfs
gnupg
go
goland
golang-migrate
goreleaser
hey
hugo
jq
lazygit
lua
ncdu
neovim
nowplaying-cli
orlangure/tap/gocovsh
pnpm
postgresql
protobuf
raycast
redis
ripgrep
rust
sketchybar
slack
spotify
starship
switchaudio-osx
tfenv
tig
tldr
tmux
tree
volta
websocat
wget
youtube-dl
sf-symbols
spotify
zsh-autosuggestions
font-hack-nerd-font
zsh-syntax-highlighting
)
# These are the currently installed packages
INSTALLED_PACKAGES=$(brew leaves)
# Extract the packages that we are missing
for index in "${!WANTED_PACKAGES[@]}"; do
if [[ "${INSTALLED_PACKAGES[*]}" =~ "${WANTED_PACKAGES[$index]}" ]]; then
unset -v WANTED_PACKAGES[$index]
fi
done
# These are the casks we want to have installed
WANTED_CASKS=(
1password
1password-cli
discord
docker
figma
firefox
firefox-developer-edition
google-chrome
insomnia
kap
mongodb-compass
monodraw
nikitabobko/tap/aerospace
nordvpn
obsidian
postman
redisinsight
)
# These are the currently installed casks
INSTALLED_CASKS=$(brew list --cask)
# Extract the casks that we are missing
for index in "${!WANTED_CASKS[@]}"; do
if [[ "${INSTALLED_CASKS[*]}" =~ "${WANTED_CASKS[$index]}" ]]; then
unset -v WANTED_CASKS[$index]
fi
done
if [ ${#WANTED_PACKAGES[@]} -eq 0 ]; then
echo_item "All packages are already installed" "green"
else
echo_item "Installing package: ${WANTED_PACKAGES[@]}" "green"
brew install ${WANTED_PACKAGES[@]}
fi
if [ ${#WANTED_CASKS[@]} -eq 0 ]; then
echo_item "All casks are already installed" "green"
else
echo_item "Installing cask: ${WANTED_CASKS[@]}" "green"
brew install ${WANTED_CASKS[@]} --cask
fi
echo_item "Performing homebrew cleanup" "green"
brew cleanup