-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·249 lines (222 loc) · 5.82 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
#!/usr/bin/env bash
# FANCY COLOOOORS! [·s
x='\033'
RESET="${x}[0m"
CYAN="${x}[0;96m"
RED="${x}[0;91m"
YELLOW="${x}[0;93m"
GREEN="${x}[0;92m"
DOTFILES="$HOME/.dotfiles"
GITHUB_REPO_URL="https://github.com/ExtinctAxolotl/dotfiles"
# informational printer
info() {
echo -e "${YELLOW}${*}${RESET}"
}
# Error printer
error() {
echo -e "${RED}${*}${RESET}"
}
# Success printer
success() {
echo -e "${GREEN}${*}${RESET}"
}
# Checking if a command is installed with command -v
is_installed_pkg() {
dpkg -s $1 > /dev/null 2>&1
}
is_installed_cmd() {
command -v $1 > /dev/null 2>&1
}
install_app() {
info "Trying to find ${1}"
if ! is_installed_pkg $1; then
read -p "Do you wan't to install $1? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing ${1}..."
sudo apt install $1
else
info "${1} Will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "${1} is already installed!\nSkipping...\n"
sleep 1
fi
}
install_snap() {
info "Trying to find ${1}"
if ! is_installed_cmd $1; then
read -p "Do you wan't to install ${1}? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing ${1}...\n"
sudo snap install $1
else
info "${1} Will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "${1} is already installed!\nSkipping...\n"
sleep 1
fi
}
install_flatpak() {
info "Trying to find ${1}"
if ! is_installed_cmd $1; then
read -p "Do you wan't to install $1? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing $1...\n"
flatpak install $1
else
info "${1} Will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "${1} is already installed!\nSkipping...\n"
sleep 1
fi
}
install_pip_app() {
info "Trying to find ${1}"
if ! is_installed_cmd $1; then
read -p "Do you wan't to install ${1}? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing ${1}...\n"
pip3 install $1
else
info "${1} Will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "${1} is already installed!\nSkipping...\n"
sleep 1
fi
}
install_code() {
info "Trying to find code..."
if ! is_installed_pkg code; then
read -p "Do you wan't to add the apt repositories and install VSCode? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
cd $HOME
info "Getting gpg key..."
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
info "Trusting Gpg key..."
sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
info "Installing VSCode..."
sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
sudo apt install apt-transport-https -y
sudo apt update -y
sudo apt install code -y
else
info "Skipping…\n"
fi
else
success "VSCode is already installed!\nSkipping...\n"
sleep 1
fi
}
install_sheldon() {
info "Trying to find sheldon..."
if ! is_installed_cmd sheldon; then
read -p "Do you wan't to install sheldon? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing sheldon..."
curl --proto '=https' -fLsS https://rossmacarthur.github.io/install/crate.sh | bash -s -- --repo rossmacarthur/sheldon --to ~/.local/bin
else
info "Sheldon will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "Sheldon is already installed!\nSkipping...\n"
sleep 1
fi
}
install_spacevim() {
info "Trying to find spacevim..."
if [ ! -d $HOME/.SpaceVim ]; then
read -p "Do you wan't to install spacevim? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing spacevim..."
curl -sLf https://spacevim.org/install.sh | bash
else
info "SpaceVim will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "SpaceVim is already installed!\nSkipping...\n"
sleep 1
fi
}
install_starship() {
info "Trying to find starship..."
if ! is_installed_cmd starship; then
read -p "Do you wan't to install starship? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
info "Installing starship..."
curl -fsSL https://starship.rs/install.sh | bash
info "INFO!\nIn order to Starship to work properly, you MUST install a nerdfont from https://nerdfonts.com\nTHANK YOU! :D"
else
info "Starship will not be installed!\nSkipping...\n"
sleep 1
fi
else
success "Starship is already installed!\nSkipping...\n"
sleep 1
fi
}
install_gui_apps() {
# install VSCode
install_code
# install Snapd
install_snap authy --beta
# install Emote
install_snap emote
# install firefox
install_app firefox
# install font manager
install_app font-manager
}
install_cli_tools() {
# install git
install_app git
# install zsh
install_app zsh
# install sheldon
install_sheldon
# install snapd
install_app snapd
# install flatpak
install_app flatpak
## add flatpak repo
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
# installing pip3
install_app python3-pip
# install bpytop
install_pip_app bpytop
# install spacevim
install_spacevim
# install starship
install_starship
}
symlink() {
read -p "Do you wan't to symlink the configurations from the dotfiles? [y/N] " -n 1 answer
if [ ${answer} == "y" ]; then
ln -sf $DOTFILES/src/bpytop/bpytop.conf $HOME/.config/bpytop/bpytop.conf
ln -sf $DOTFILES/src/sheldon/plugins.toml $HOME/.config/sheldon/plugins.toml
ln -sf $DOTFILES/src/SpaceVim/init.toml $HOME/.SpaceVim.d/init.toml
ln -f $DOTFILES/src/starship/starship.toml $HOME/.config/starship.toml
ln -sf $DOTFILES/src/zsh/zshrc $HOME/.zshrc
fi
}
on_finish() {
echo
echo
success "Finished Installing your fresh dotfiles!"
success "Happy Coding!"
}
main() {
install_cli_tools "$*"
install_gui_apps "$*"
symlink "$*"
on_finish "$*"
}
main "$*"