-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfresh-install.sh
523 lines (494 loc) Β· 15.2 KB
/
fresh-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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
#!/usr/bin/env bash
#---------------------------------------------------------------------------------------------
#
# βββββββ βββββββ βββββββ ββββββββ βββββββββββββββββββββ ββββββ βββββββ
# ββββββββ ββββββββββββββββ ββββββββββ ββββββββββββββββββββββββββββββββββββββ
# βββ βββββββββββββββββββββββββββββββββββββββββββββ βββ ββββββββββββββββ
# βββ ββββββββββββββββββββββββββββββββββββββββββββ βββ ββββββββββββββββ
# ββββββββββββ βββββββββ βββ ββββββ βββ βββββββββββ βββ βββ ββββββ βββ
# βββββββ βββ βββββββββ ββββββ βββββββββββ βββ βββ ββββββ βββ
#
#---------------------------------------------------------------------------------------------
#
# Fresh_Install
# Installation script for a fresh Ubuntu setup, running on WSL2. on Windows 10.
# To run, use './fresh_install.sh'
#
# Source:
# [Grimmstar's .dotfiles](https://github.com/Grimmstar/.dotfiles)
#
# Authors:
# Cyriina Grimm <[email protected]>
#
#---------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------
# Config
# Using '-e' ensures the script will exit if it encounters an error.
set -e
set -o pipefail
source $(dirname $0)/utils/color_codes.sh
source $(dirname $0)/utils/logging_utils.sh
source $(dirname $0)/utils/functions.sh
traperr() {
echo "ERROR: ${BASH_SOURCE[1]} at about ${BASH_LINENO[0]}"
}
set -o errtrace
trap traperr ERR
#---------------------------------------------------------------------------------------------
# Script
# Start by displaying our banner, then have the script pause for a moment
show_header
sleep 2
# Display 5 seconds count down before script executes
for i in $(seq 5 -1 1); do
echo -ne "$i\rGetting ready to proceed with the automation in... "
sleep 1
done
printf "${BPurple}
####################################################
#${NC} ${BWhite}Pre-Config${NC} ${BPurple}#
####################################################${NC}"
sleep 1
c_info "We need to check some preliminary things before we can really get to work..."
sleep 1
# Create my own bin folder if it doesn't exist
[[ ! -d "${HOME}/bin" ]] && mkdir "${HOME}/bin"
# Create autostart folder if it doesn't exist
[[ ! -d "${HOME}/.config/autostart" ]] && mkdir -p "${HOME}/.config/autostart"
c_info "I believe we're ready to begin..."
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π ${BWhite}3rd-party PPAs${NC} π ${BPurple}#
####################################################${NC}"
sleep 1
c_info "This step adds the private repositories for Ubuntu, Git, Docker, and NGINX, amongst others, so that we can be sure they are always the most up-to-date version."
sleep 1
c_question "Do you want to add the PPAs? [y/n]"
read ppa_answer
case "$ppa_answer" in
y | Y | yes | Yes)
c_hilight "Adding PPAs..."
add_ppas
c_success "PPA list is updated!"
;;
n | N | no | No)
c_error "Skipping adding PPAs..."
;;
*)
c_warning "Please respond with yes or no..."
;;
esac
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π» ${BWhite}System Update${NC} π» ${BPurple}#
####################################################${NC}"
sleep 1
c_info "Now updating the system repositories, upgrading the system, and removing unnecessary or obsolete packages..."
update_system
c_success "System is up to date!"
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π¦ ${BWhite}Package Installation${NC} π¦ ${BPurple}#
####################################################${NC}"
sleep 1
c_info "This step looks for a base packages list at ~/.dotfiles/utils/lists/packages.txt and installs those packages."
sleep 1
c_question "Do you want to install base packages? [y/n]"
read apt_answer
case "$apt_answer" in
y | Y | yes | Yes)
c_success "Installing packages..."
install_packages
;;
n | N | no | No)
c_warning "Skipping package installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π ${BWhite}Dev Libraries${NC} π ${BPurple}#
####################################################${NC}"
sleep 1
c_info "This step looks for a development packages list at ~/.dotfiles./utils/lists/dev_packages.txt and then installs those packages."
sleep 1
c_question "Do you want to install dev packages? [y/n]"
read dev_answer
case "$dev_answer" in
y | Y | yes | Yes)
c_success "Installing dev packages..."
install_dev
;;
n | N | no | No)
c_warning "Skipping dev package installation..."
;;
*)
c_warning "Please respond with yes or no"
;;
esac
sleep 2
c_info "Ensuring that we can communicate through the Windows network..."
windows
sleep 2
c_info "Configuring systemd to work so that we can use the `systemd` command..."
configure_systemd
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π ${BWhite}SSH Keys${NC} π ${BPurple}#
####################################################${NC}"
sleep 1
c_info "We need to check for SSH keys in ~/.ssh/id_rsa.pub, then generate one if it doesn't exist."
sleep 1
c_question "Check for keys? [y/n]"
read ssh_answer
case "$ssh_answer" in
y | Y | yes | Yes)
c_success "Installing SSH ..."
install_ssh
c_success "Creating keys ..."
create_ssh_key
c_success "Keys created! You need to add it to Github now..."
test_ssh_key
c_success "SSH setup is now complete..."
;;
n | N | no | No)
c_warning "Skipping SSH installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π ${BWhite}Github${NC} π ${BPurple}#
####################################################${NC}"
sleep 1
if type "gh" >/dev/null; then
c_success "π Github Cli is already installed!"
fi
if ! type "gh" >/dev/null; then
c_info "Github Cli is not installed..."
c_question "Would you like to install Github Cli? [y/n]"
read gh_answer
case "$gh_answer" in
y | Y | yes | Yes)
c_success "Working on it..."
install_github
github_shh
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping Github installation..."
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π ${BWhite}Python 2 & 3${NC} π ${BPurple}#
####################################################${NC}"
sleep 1
if type "pip" >/dev/null; then
if type "pip3" >/dev/null; then
c_success "π Python is already installed! We can move on..."
fi
fi
if ! type "pip" >/dev/null; then
if ! type "pip3" >/dev/null; then
c_info "Looks like Python is missing..."
c_question "Install Python? [y/n]"
read py_answer
case "$py_answer" in
y | Y | yes | Yes)
c_success "Installing Python..."
install_python
c_success "π Python has been installed!"
;;
n | N | no | No)
c_warning "Skipping π Python installation..."
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} 𧑠${BWhite}NVM (Node Version Manager)${NC} 𧑠${BPurple}#
####################################################${NC}"
sleep 1
if type "nvm" >/dev/null; then
c_success "𧑠NVM is already installed!"
fi
if ! type "nvm" >/dev/null; then
c_info "NVM (Node Version Manager) grants the ability to have multiple NodeJS versions installed, and manage them efficiently. It doesn't look like 𧑠NVM is currently installed..."
sleep 2
c_question "Would you like to install NVM and the latest LTS version of NodeJS? [y/n]"
read node_answer
case "$node_answer" in
y | Y | yes | Yes)
c_success "Installing NVM/Node..."
install_node
c_success "𧑠NVM/Node has been installed!"
;;
n | N | no | No)
c_warning "Skipping 𧑠Node installation..."
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π ${BWhite}PostgreSQL & PostGres CLI${NC} π ${BPurple}#
####################################################${NC}"
sleep 1
if type "psql" >/dev/null; then
c_success "π PostgreSQL & π PostGres CLI are already installed!"
fi
if ! type "psql" >/dev/null; then
c_info "The PostgreSQL database is one of the more popular options, and the PostGres CLI makes it easier to interact with."
sleep 1
c_question "Would you like to install the PostgreSQL database & the PostGres CLI? [y/n]"
read psql_answer
case "$psql_answer" in
y | Y | yes | Yes)
c_success "Working on it..."
install_postgres
c_success "π PostgreSQL has been installed!"
;;
n | N | no | No)
c_warning "Skipping π Postgres installation..."
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} πβοΈ ${BWhite}Google Cloud${NC} βοΈπ ${BPurple}#
####################################################${NC}"
sleep 1
if type "gcloud" >/dev/null; then
c_success "πβοΈ Google Cloud SDK is already installed!"
fi
if ! type "gcloud" >/dev/null; then
c_info "This step will instll GCloud stuff, which you'll need if you want the Docker install to complete successfully"
sleep 1
c_question "Proceed? [y/n]"
read gcloud_answer
case "$gcloud_answer" in
y | Y | yes | Yes)
c_success "Working on it..."
install_gcloud
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping GCloud installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} π³ ${BWhite}Docker & Docker-Compose${NC} π³ ${BPurple}#
####################################################${NC}"
sleep 1
if type "docker" >/dev/null; then
c_success "π³ Docker is already installed!"
fi
if ! type "docker" >/dev/null; then
c_info "This step will instll π³ Docker stuff, including Docker-Compose"
sleep 1
c_question "Proceed? [y/n]"
read docker_answer
case "$docker_answer" in
y | Y | yes | Yes)
c_success "Doing the things..."
install_docker
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping π³ Docker installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} ${BWhite}AWS (Amazon Web Service)${NC} ${BPurple}#
####################################################${NC}"
sleep 1
if type "aws" >/dev/null; then
c_success "AWS is already installed!"
fi
if ! type "aws" >/dev/null; then
c_info "This step will instll the AWS (Amazon Web Service) and CLI."
sleep 1
c_question "Proceed? [y/n]"
read aws_answer
case "$aws_answer" in
y | Y | yes | Yes)
c_success "One moment..."
install_aws
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping AWS installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} ${BWhite}Heroku and Heroku CLI${NC} ${BPurple}#
####################################################${NC}"
sleep 1
if type "heroku" >/dev/null; then
c_success "Heroku is already installed!"
fi
if ! type "heroku" >/dev/null; then
c_info "This step will instll Heroku and Heroku CLI."
sleep 1
c_question "Proceed? [y/n]"
read heroku_answer
case "$heroku_answer" in
y | Y | yes | Yes)
c_success "Okie dokie..."
install_heroku
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping Heroku installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
#${NC} ${BWhite}asdf Plugins${NC} ${BPurple}#
####################################################${NC}"
sleep 1
if type "asdf" >/dev/null; then
c_success "asdf is already installed!"
fi
if ! type "asdf" >/dev/null; then
c_info "This step will instll asdf and asdf plugins."
sleep 1
c_question "Proceed? [y/n]"
read asdf_answer
case "$asdf_answer" in
y | Y | yes | Yes)
c_success "As you wish..."
install_asdf
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping asdf installation"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
fi
sleep 2
echo -e "${BPurple}
####################################################
# ${NC} ${BWhite}System Modifications${NC} ${BPurple}#
####################################################${NC}"
sleep 1
c_info "Now that everything is installed as far as programs go, it's time to customize the system..."
sleep 1
c_question "Do you want to install allow these mods? [y/n]"
read mods_answer
case "$mods_answer" in
y | Y | yes | Yes)
c_success "I'm on it..."
system_mods
auto_start
c_success "Done!"
;;
n | N | no | No)
c_warning "Skipping system modification"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
sleep 2
echo -e "${BPurple}
####################################################
#${NC} ${BWhite}Dotfiles and Configs${NC} ${BPurple}#
####################################################${NC}"
sleep 1
c_info "It's time to copy over our personal dotfiles and configs, and create symlinks and backups..."
sleep 1
c_question "Do you want to allow these mods? [y/n]"
read dotfiles_answer
case "$dotfiles_answer" in
y | Y | yes | Yes)
c_success "Please tell me we're almost done..."
link_dotfiles .aliases
link_dotfiles .bash_profile
link_dotfiles .bash_prompt
link_dotfiles .bashrc
link_dotfiles .colors
link_dotfiles .curlrc
link_dotfiles .dircolors
link_dotfiles .editorconfig
link_dotfiles .env
link_dotfiles .exports
link_dotfiles .gitconfig
link_dotfiles .gitignore
link_dotfiles .npmrc
link_dotfiles .nvmrc
link_dotfiles .path
link_dotfiles .profile
link_dotfiles .sshrc
link_dotfiles .tmux.config
# link_dotfiles .prompt
link_dotfiles .wgetrc
link_dotfiles colors.bash
c_success "Finally!"
;;
n | N | no | No)
c_warning "Skipping dotfiles modification"
;;
*)
c_warning "Please respond with yes or no"
;;
esac
sleep 5
c_success "That's it, we've finished everything on the list!"
sleep 2
figlet "Things are set up just the way you like them. You're welcome, lazy human!" | lolcat
sleep 5