-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·153 lines (111 loc) · 3.88 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
#!/usr/bin/env bash
# get path to script directory
curr_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
scripts_dir="$curr_dir/scripts"
# get some util functions
source $scripts_dir/utils/checker.sh
echo "
Welcome to the setup script!
\nThe following tools and utilities will be installed (DEFAULT):
- curl for downloading files
- git for version control
- oh-my-zsh (with autosuggestions) for a better terminal experience
\nThe script also offers the following additions (OPTIONAL):
- docker for containerization
- podman for security-focused containerization
- nodejs (with npm and pnpm) for javascript development
- python (with pip) for python development
- mongodb for database management
\nYou can choose to install the default utilities or to customize your setup with the optional utilities.\n"
# ask user if they want to customize their setup
read -p "Do you want to customize your setup? (y/N): " customize
if ! check_response $customize; then
echo "Invalid response: $customize"
exit 1
fi
# ========= CUSTOMIZE SETUP - go through each utility and ask user if they want to install it =========
if is_yes $customize; then
# Docker
read -p "Do you want to install docker? (y/N): " install_docker
if ! check_response $install_docker; then
echo "Invalid response: $install_docker"
exit 1
fi
# Podman
read -p "Do you want to install podman? (y/N): " install_podman
if ! check_response $install_podman; then
echo "Invalid response: $install_podman"
exit 1
fi
# Nodejs
read -p "Do you want to install nodejs? (y/N): " install_nodejs
if ! check_response $install_nodejs; then
echo "Invalid response: $install_nodejs"
exit 1
fi
if is_yes $install_nodejs ]; then
read -p "Which version of nodejs do you want to install? (leave blank for latest): " node_version
if ! check_version $node_version; then
if ! [ "$node_version" = "" ]; then
echo "Invalid version number: $node_version"
exit 1
fi
fi
fi
# Python
read -p "Do you want to install python? (y/N): " install_python
if ! check_response $install_python; then
echo "Invalid response: $install_python"
exit 1
fi
# MongoDB
read -p "Do you want to install mongodb? (y/N): " install_mongodb
if ! check_response $install_mongodb; then
echo "Invalid response: $install_mongodb"
exit 1
fi
# oh-my-zsh
read -p "Do you want to install zsh + oh-my-zsh? (y/N): " install_oh_my_zsh
# throw error if response is invalid
if ! check_response $install_oh_my_zsh; then
echo "Invalid response: $install_oh_my_zsh"
exit 1
fi
fi
# ========= INSTALL UTILITIES - go through each utility and install it if user has given permission =========
# run basic install script
echo "\nInstalling utilities..."
bash $scripts_dir/setup-basics.sh
# this if statement blocks the script from running the rest of the install scripts if the
# user doesn't want to customize their setup
if ! is_yes $customize; then
# reset the update flag
reset_update_flag
echo "\nSetup complete!"
exit 0
fi
if is_yes $install_docker; then
echo "\nRunning docker install script..."
bash $scripts_dir/setup-docker-engine.sh
fi
if is_yes $install_podman; then
echo "\nRunning podman install script..."
bash $scripts_dir/setup-podman.sh
fi
if is_yes $install_nodejs; then
echo "\nRunning nodejs install script..."
bash $scripts_dir/setup-nodejs.sh $node_version
fi
if is_yes $install_python; then
echo "\nRunning python install script..."
bash $scripts_dir/setup-python.sh
fi
if is_yes $install_mongodb; then
echo "\nRunning mongodb install script..."
bash $scripts_dir/setup-mongodb.sh
fi
if is_yes $install_oh_my_zsh; then
echo "\nRunning oh-my-zsh install script..."
bash $scripts_dir/setup-oh-my-zsh.sh $theme
fi
reset_update_flag