-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·206 lines (178 loc) · 3.94 KB
/
setup.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
#!/usr/bin/env bash
readonly GREEN='\033[0;32m'
readonly RED='\033[0;31m'
readonly YELLOW='\033[1;33m'
readonly NC='\033[0m' # No Color
readonly LBLUE='\033[1;36m'
# Spacing variables
readonly TAB=' '
readonly TABx2=' '
readonly TABx3=' '
# Function used to color echo text in green (success)
echo_success() {
echo "${GREEN}[OKAY]${NC}${TABx2}$@${NC}"
}
# Function used to color echo text in red (error)
echo_error() {
echo >&2 "${RED}[ERROR]${NC}${TAB}$@${NC}"
exit 1
}
# Function used to color echo text in light-blue (info)
echo_info() {
echo "${LBLUE}[INFO]${NC}${TABx2}$@${NC}"
}
install_brew(){
echo_info "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo_success "Done!"
}
install_zsh(){
echo_info "Installing zsh..."
brew install zsh
echo_success "Done!"
}
install_oh_my_zsh(){
echo_info "Installing oh-my-zsh..."
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
echo_success "Done!"
}
install_oh_my_zsh_plugins(){
echo_info "Installing oh-my-zsh plugins..."
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
echo_success "Done!"
}
install_brew_packages(){
echo_info "Installing brew packages..."
brew install \
starship \
wget \
fnm \
fzf \
ripgrep \
bat \
lsd \
fd \
jq \
yq \
kubectl \
kubectx \
tfenv \
derailed/k9s/k9s \
difftastic \
mcfly \
make \
watch \
helm \
colordiff \
bash \
ruby \
tmux \
terraform-docs \
tflint \
commitizen \
git-delta \
ripgrep
echo_success "Done!"
}
install_aws_cli(){
echo_info "Installing AWS CLI..."
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
echo_success "Done!"
}
install_rust(){
echo_info "Installing Rust..."
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
echo_success "Done!"
}
install_go(){
echo_info "To install Go visit: https://go.dev/doc/install"
}
install_node(){
echo_info "Installing Node..."
fnm install --lts
echo_success "Done!"
eval "$(fnm env --use-on-cd)"
echo_info "Installing Yarn..."
npm install --global yarn
echo_success "Done!"
}
copy_configs(){
echo_info "Copying configs..."
cp -r ./home/ ~/
echo_success "Done!"
}
append_to_zshrc(){
echo_info "Appending to .zshrc..."
echo '
alias l="lsd -l"
alias ll="lsd -la"
alias k="kubectl"
alias kx="kubectx"
alias ks="kubens"
alias tfi="terraform init"
alias tfp="terraform plan"
alias tfa="terraform apply"
alias tfr="terraform refresh"
alias tf="terraform"
alias ts="terraspace"
alias tsp="terraspace plan"
alias tsup="terraspace up"
# Python3 + Pip Setup
alias pip='pip3'
alias python='python3'
export PIP_DIR=$(python -m site --user-base)
export PATH="${PIP_DIR}/bin:$PATH"
# Startup script
export FZF_CTRL_T_OPTS="
--walker-skip .git,node_modules,target
--preview 'bat -n --color=always {}'
--bind 'ctrl-/:change-preview-window(down|hidden|)'"
eval "$(starship init zsh)"
eval "$(mcfly init zsh)"
eval "$(fnm env --use-on-cd)"
awsv() {
aws-vault exec ${AWS_PROFILE} -- aws $@
}
tfv() {
aws-vault exec ${AWS_PROFILE} -- terraform $@
}
' >> ~/.zshrc
echo_success "Done!"
}
info(){
echo_info "Please add the following to your .zshrc file"
echo '
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
docker
aws
kubectl
)
'
}
setup_shell() {
chsh -s $(which zsh)
source ~/.zshrc
}
main() {
echo_info "Starting setup..."
install_brew
install_zsh
install_oh_my_zsh
install_oh_my_zsh_plugins
append_to_zshrc
install_brew_packages
install_aws_cli
install_rust
install_go
install_node
copy_configs
setup_shell
info
echo_success "Setup complete!"
}
main