-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·385 lines (350 loc) · 8.27 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
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
#!/bin/bash
function installed() {
command -v $1 &>/dev/null
}
function skipping() {
echo "Skipping: $(which $1) is already installed"
}
function install_basics() {
echo "[Installing basic system packages]"
sudo apt update
sudo apt install -y \
software-properties-common \
build-essential \
gcc \
g++ \
make \
htop \
tmux \
git \
fonts-jetbrains-mono \
tmux \
fzf \
ripgrep \
stow \
gnome-tweaks \
xclip
printf "\n"
}
function install_zsh() {
echo "[Installing Zsh]"
if ! installed zsh; then
sudo apt update && sudo apt install -y zsh
else
skipping zsh
fi
printf "\n"
}
function configure_shell() {
echo "[Configuring zsh]"
if [ ! -d ~/.oh-my-zsh ]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
rm ~/.zshrc
(
cd ~/dotfiles
stow wezterm zsh tmux nvim sqlite touchegg --verbose=2
)
chsh -s $(which zsh)
echo "Logout and login to apply changes."
exit
else
echo "Skipping: ~/.oh-my-zsh is already installed"
fi
printf "\n"
}
function install_neovim() {
echo "[Installing Neovim]"
if ! installed nvim; then
(
cd ~
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod +x nvim.appimage
sudo chown root:root nvim.appimage
sudo mv nvim.appimage /usr/bin/nvim
)
else
skipping nvim
fi
printf "\n"
}
function install_tpm() {
echo "[Installing tpm]"
if [ ! -d ~/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
else
echo "Skipping: ~/.tmux/plugins/tpm is already installed"
fi
printf "\n"
}
function install_python() {
echo "[Installing Python]"
if ! grep -q "^deb .*deadsnakes/ppa" /etc/apt/sources.list /etc/apt/sources.list.d/*; then
sudo add-apt-repository ppa:deadsnakes/ppa
fi
sudo apt update && sudo apt install -y \
python3-pip \
python3-dev \
python3-venv \
python-is-python3 \
python3.11 \
python3.11-dev \
python3.11-venv
printf "\n"
}
function install_pyright() {
echo "[Installing pyright]"
if ! installed pyright; then
pip install pyright
else
skipping pyright
fi
printf "\n"
}
function install_black() {
echo "[Installing black]"
if ! installed black; then
pip install black
else
skipping black
fi
printf "\n"
}
function install_isort() {
echo "[Installing isort]"
if ! installed isort; then
pip install isort
else
skipping isort
fi
printf "\n"
}
function install_ruff() {
echo "[Installing ruff]"
if ! installed ruff; then
pip install ruff
else
skipping ruff
fi
printf "\n"
}
function install_go() {
echo "[Installing Go]"
if ! installed go; then
(
cd ~
wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz
rm go1.20.3.linux-amd64.tar.gz
)
else
skipping go
fi
printf "\n"
}
function install_gopls() {
echo "[Installing gopls]"
if ! installed gopls; then
go install golang.org/x/tools/gopls@latest
else
skipping gopls
fi
printf "\n"
}
function install_shfmt() {
echo "[Installing shfmt]"
if ! installed shfmt; then
go install mvdan.cc/sh/v3/cmd/shfmt@latest
else
skipping shfmt
fi
printf "\n"
}
function install_nodejs() {
echo "[Installing NodeJS]"
if ! installed node; then
(
curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo apt install -y nodejs
rm nodesource_setup.sh
)
else
skipping node
fi
printf "\n"
}
function install_prettier() {
echo "[Installing prettier]"
if ! installed prettier; then
npm install -g prettier
else
skipping prettier
fi
printf "\n"
}
function install_deno() {
echo "[Installing Deno]"
if ! installed deno; then
curl -fsSL https://deno.land/x/install/install.sh | sh
else
skipping deno
fi
printf "\n"
}
function install_rust() {
echo "[Installing Rust]"
if ! installed rustc; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
else
skipping rustc
fi
printf "\n"
}
function install_stylua() {
echo "[Installing stylua]"
if ! installed stylua; then
cargo install stylua
else
skipping stylua
fi
printf "\n"
}
function install_lua_lsp() {
echo "[Installing Lua LSP]"
if ! installed lua-language-server; then
mkdir -p ~/.config/lsp/lua-language-server
(
cd ~/.config/lsp/lua-language-server
wget https://github.com/sumneko/lua-language-server/releases/download/3.6.4/lua-language-server-3.6.4-linux-x64.tar.gz
tar -xvf lua-language-server-3.6.4-linux-x64.tar.gz
rm lua-language-server-3.6.4-linux-x64.tar.gz
)
else
skipping lua-language-server
fi
printf "\n"
}
function install_docker() {
echo "[Installing Docker]"
if ! installed docker; then
sudo apt update && sudo apt install -y \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
echo "------------------------------------------------------------------"
sudo apt update && sudo apt install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo groupadd docker
sudo usermod -aG docker $USER
else
skipping docker
fi
printf "\n"
}
function install_chrome() {
echo "[Installing Chrome]"
if ! installed google-chrome-stable; then
(
cd ~
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i google-chrome-stable_current_amd64.deb
rm google-chrome-stable_current_amd64.deb
)
else
skipping google-chrome-stable
fi
printf "\n"
}
function remove_firefox() {
echo "[Removing Firefox]"
if installed firefox; then
sudo apt remove firefox -y
else
echo "Skipping: firefox is already removed"
fi
printf "\n"
}
function install_1password() {
echo "[Installing 1password]"
if ! installed 1password; then
curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/keyrings/1password-archive-keyring.gpg
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/1password-archive-keyring.gpg] https://downloads.1password.com/linux/debian/amd64 stable main' | sudo tee /etc/apt/sources.list.d/1password.list
sudo mkdir -p /etc/debsig/policies/AC2D62742012EA22/
curl -sS https://downloads.1password.com/linux/debian/debsig/1password.pol | sudo tee /etc/debsig/policies/AC2D62742012EA22/1password.pol
sudo mkdir -p /usr/share/debsig/keyrings/AC2D62742012EA22
curl -sS https://downloads.1password.com/linux/keys/1password.asc | sudo gpg --dearmor --output /usr/share/debsig/keyrings/AC2D62742012EA22/debsig.gpg
sudo apt update && sudo apt install -y 1password
else
skipping 1password
fi
printf "\n"
}
function add_flatpak_remote() {
echo "[Adding flathub as flatpak remote]"
sudo flatpak remote-add --system --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
printf "\n"
}
function install_wezterm() {
echo "[Installing WezTerm]"
sudo flatpak install -y flathub org.wezfurlong.wezterm
printf "\n"
}
function install_telegram() {
echo "[Installing Telegram]"
sudo flatpak install -y flathub org.telegram.desktop
printf "\n"
}
function install_spotify() {
echo "[Installing Spotify]"
sudo flatpak install -y flathub com.spotify.Client
printf "\n"
}
function install_todoist() {
echo "[Installing Todoist]"
sudo flatpak install -y flathub com.todoist.Todoist
printf "\n"
}
function install_obsidian() {
echo "[Installing Obsidian]"
sudo flatpak install -y flathub md.obsidian.Obsidian
printf "\n"
}
function install_dejadup() {
echo "[Installing DejaDup]"
sudo flatpak install -y flathub org.gnome.DejaDup
printf "\n"
}
#install_basics
#install_zsh
#configure_shell
#install_neovim
#install_tpm
#install_python
# install_pyright
# install_black
# install_isort
# install_ruff
# install_go
# install_gopls
# install_shfmt
#install_nodejs
# install_prettier
# install_deno
# install_rust
# install_stylua
# install_lua_lsp
# install_docker
#install_chrome
#remove_firefox
#install_1password
#add_flatpak_remote
#install_wezterm
#install_telegram
#install_spotify
#install_todoist
#install_obsidian
#install_dejadup