-
Notifications
You must be signed in to change notification settings - Fork 69
/
install.sh
executable file
·293 lines (265 loc) · 6.33 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#!/usr/bin/env bash
taps=(
"popcorn-official/popcorn-desktop https://github.com/popcorn-official/popcorn-desktop.git"
)
# See https://sdkman.io/
sdks=(
"java 8.0.352-amzn"
"sbt 1.8.3"
"scala 2.12.18"
)
brews=(
# Install some stuff before others so we can start settings things up!
# Software
authy
dropbox
firefox
google-chrome
warp
jetbrains-toolbox
rectangle
stats
spotify
visual-studio-code
slack
# Command line utils
awscli
bash
gimme-aws-creds
git
python3
# Software
aerial
adobe-acrobat-pro
cakebrew
# cleanmymac # CI failure
colima
dropbox-capture
dropbox-dash
expressvpn
geekbench
github
handbrake
iina
itsycal
keepingyouawake
launchrocket
little-snitch
lunar
monitorcontrol
muzzle
popcorn-time
private-eye
satellite-eyes
sidekick # http://oomphalot.com/sidekick/
sloth # https://sveinbjorn.org/sloth
soundsource # https://rogueamoeba.com/soundsource/
steam
"--cask transmission" # This is to install the software and not the CLI
# Command line tools
"bash-snippets --without-all-tools --with-cryptocurrency --with-stocks --with-weather"
bat
coreutils
colima
docker
docker-compose
dfc # https://github.com/rolinh/dfc
exa # https://the.exa.website/
findutils
"fontconfig --universal"
git-extras # for git undo
git-lfs
"gnuplot --with-qt"
"gnu-sed --with-default-names"
go
gpg
hstr # https://github.com/dvorka/hstr
htop # https://htop.dev/
httpie # https://httpie.io/
iftop # https://www.ex-parrot.com/~pdw/iftop/
"imagemagick --with-webp"
lnav # https://lnav.org/
m-cli # https://github.com/rgcr/m-cli
mas # https://github.com/mas-cli/mas
micro # https://github.com/zyedidia/micro
mtr # https://www.bitwizard.nl/mtr/
neofetch # https://github.com/dylanaraps/neofetch
node
poppler # https://poppler.freedesktop.org/
postgresql
pgcli
pv # https://www.ivarch.com/programs/pv.shtml
python
osquery
ruby
shellcheck # https://www.shellcheck.net/
thefuck # https://github.com/nvbn/thefuck
tmux
tree
trash
"vim --with-override-system-vi"
"wget --with-iri"
xquartz
xsv
yarn
youtube-dl
)
pips=(
pip
glances
nbstripout
ohmu
pythonpy
poetry
streamlit
)
gems=(
bundler
)
npms=(
gitjk
n # https://github.com/tj/n
npx
)
# Git configs
gpg_key='3E219504'
git_email='[email protected]'
# See https://jvns.ca/blog/2024/02/16/popular-git-config-options/
git_configs=(
"branch.autoSetupRebase always"
"color.ui auto"
"core.autocrlf input"
"core.pager delta"
"diff.algorithm histogram"
"credential.helper osxkeychain"
"help.autocorrect 10"
"init.defaultBranch master"
"merge.ff false"
"merge.conflictstyle zdiff3"
"pull.rebase true"
"push.default simple"
"rebase.autostash true"
"rerere.autoUpdate true"
"remote.origin.prune true"
"rerere.enabled true"
"user.name pathikrit"
"user.email ${git_email}"
"user.signingkey ${gpg_key}"
)
fonts=(
font-fira-code
font-source-code-pro
)
######################################## End of app list ########################################
set +e
set -x
function install {
cmd=$1
shift
for pkg in "$@";
do
exec="$cmd $pkg"
if ${exec} ; then
echo "Installed $pkg"
else
echo "Failed to execute: $exec"
if [[ -n "${CI}" ]]; then
exit 1
fi
fi
done
}
function brew_install_or_upgrade {
if brew ls --versions "$1" >/dev/null; then
if (brew outdated | grep "$1" > /dev/null); then
echo "Upgrading already installed package $1 ..."
brew upgrade "$1"
else
echo "Latest $1 is already installed"
fi
else
brew install "$1"
fi
}
if [[ -z "${CI}" ]]; then
sudo -v # Ask for the administrator password upfront
# Keep-alive: update existing `sudo` time stamp until script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
fi
######################################## Start Installing ########################################
if test ! "$(command -v brew)"; then
echo "Installing Homebrew ..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
echo "Completel Homebrew installation and rerun this script ..."
exit 0
else
if [[ -z "${CI}" ]]; then
echo "Updating Homebrew ..."
brew update
brew upgrade
brew doctor
fi
fi
export HOMEBREW_NO_AUTO_UPDATE=1
echo "Installing SDKs ..."
curl -s "https://get.sdkman.io" | bash
# shellcheck source=/dev/null
source "$HOME/.sdkman/bin/sdkman-init.sh"
for sdk in "${sdks[@]}"
do
# shellcheck disable=SC2086
sdk install ${sdk}
done
sdk current
echo "Installing NVM ..."
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
echo "Installing software ..."
for tap in "${taps[@]}"
do
# shellcheck disable=SC2086
brew tap ${tap}
done
install 'brew_install_or_upgrade' "${brews[@]}"
brew link --overwrite ruby
echo "Setting up git defaults ..."
for config in "${git_configs[@]}"
do
git config --global "${config}"
done
echo "Setting up bash aliases ..."
echo "
alias del='mv -t ~/.Trash/'
alias ls='exa -l'
alias cat=bat
" >> ~/.bash_profile
# https://github.com/twolfson/sexy-bash-prompt
echo "Setting up bash prompt ..."
# shellcheck source=/dev/null
(cd /tmp && ([[ -d sexy-bash-prompt ]] || git clone --depth 1 --config core.autocrlf=false https://github.com/twolfson/sexy-bash-prompt) && cd sexy-bash-prompt && make install) && source ~/.bashrc
chsh -s /bin/bash
echo "Installing secondary packages ..."
install 'pip3 install --upgrade' "${pips[@]}"
install 'gem install' "${gems[@]}"
install 'npm install --global --force' "${npms[@]}"
echo "Installing fonts ..."
brew tap homebrew/cask-fonts
install 'brew install' "${fonts[@]}"
echo "Updating packages ..."
pip3 install --upgrade pip setuptools wheel
if [[ -z "${CI}" ]]; then
m update install all
fi
if [[ -z "${CI}" ]]; then
echo "Install following software from the App Store"
mas list
fi
if [[ -z "${CI}" ]]; then
echo "Export key to Github ..."
gpg --keyserver hkp://pgp.mit.edu --recv ${gpg_key}
ssh-keygen -t rsa -b 4096 -C ${git_email}
pbcopy < ~/.ssh/id_rsa.pub
open https://github.com/settings/ssh/new
fi
echo "Cleanup"
brew cleanup
echo "Done!"