-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·347 lines (288 loc) · 10.5 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
#!/usr/bin/env bash
format_help=" %-20s\t%-54s\n"
bold=$(tput bold)
color=$(tput setaf 3)
normal=$(tput sgr0)
arrow="${color}${bold}=>${normal}"
function _help() {
echo "Berkcan Ucan (alcadramin) <[email protected]>"
echo "${bold}Description:${normal} This script will help you to setup your environment and load dotfiles as well as create a backup."
echo ""
echo "${bold}USAGE: ${normal}"
echo " sh -e setupEnvironment.sh [FLAGS] or ./setupEnvironment [FLAGS]"
echo ""
echo "${bold}FLAG: ${normal}"
printf "${format_help}" \
"-h, --help, help" "Print this help message" \
"-i, --install, help" "Install required applications and copy dotfiles (AUR helper is required for Arch based distributions)" \
"-b, --backup, backup" "Copy local dotfiles to this directory"
}
function _init() {
echo " _ _____"
echo "| | |____ |"
echo "| |____ __ / /_ _"
echo "| '_ \ \ /\ / / \ \ | | |"
echo "| |_) \ V V /.___/ / |_| |"
echo "|_.__/ \_/\_/ \____/ \__,_|"
echo ""
echo "${arrow} Starting script.."
}
function _install() {
local OS=$(awk -F'"' '/NAME/ {print $2; exit}' /etc/os-release)
if command -v paru &>/dev/null; then
echo "${arrow} Your OS: $OS - Arch Based Distribution (paru)"
echo "${arrow} Starting installation.."
withParu
elif command -v yay &>/dev/null; then
echo "${arrow} Your OS: $OS - Arch Based Distribution (yay)"
echo "${arrow} Starting installation.."
withYay
elif command -v apt &>/dev/null; then
echo "${arrow} Your OS: $OS - Debian Based Distribution (apt)"
echo "${arrow} Starting installation.."
withApt
else
echo "${arrow} Could not detect your OS, can't install applications. Exiting.."
exit 1
fi
}
function withParu() {
echo "${arrow} Would you like to install utility apps? (picom, nitrogen, dmenu etc..): (yes/no)"
read INSTALL_UTILITY
if [[ $INSTALL_UTILITY == "yes" || $INSTALL_UTILITY == "y" ]]; then
echo "${arrow} Installing utility apps.."
/usr/bin/paru -S --skipreview rsync python psmisc xorg-xprop xorg-xwininfo ffmpeg wireless_tools amazon-corretto-11 \
pulseaudio pulseaudio-alsa alsa-utils brightnessctl nitrogen gnome-calendar dmenu rofi xfce4-power-manager \
lxappearance lxsession xautolock xclip flameshot jome-git volumeicon xfce4-notifyd polkit-gnome ffmpegthumbnailer \
tumbler viewnior mpv mpd mpc ncmpcpp trayer network-manager-applet pavucontrol parcellite neofetch htop picom-git gtk2-perl playerctl xsettingsd
else
echo "${arrow} You chose: ${INSTALL_UTILITY}"
fi
echo "${arrow} Copying dotfiles.."
rsync -avxRHAXP .oh-my-zsh/ .config/picom/ .zshrc .Xresources ~/
echo "${arrow} Let's check if I am running the script, will copy personal stuff (gitconfig etc.). Are you ${bold}alcadramin${normal}? (yes/no)"
read alcadramin
if [[ $alcadramin == "yes" || $alcadramin == "y" ]]; then
echo "${arrow} Copying personal stuff.."
rsync -avxRHAXP .gitconfig .xprofile .config/xrandr.sh .profile ~/
fi
echo "${arrow} Would you like to install window manager and setup the dotfiles? (yes/no)"
read INSTALL_WM
if [[ $INSTALL_WM == "yes" || $INSTALL_WM == "y" ]]; then
windowManager paru
else
echo "${arrow} You chose: ${INSTALL_WM}"
fi
echo "${arrow} Would you like to install terminal emulator and setup the dotfiles? (yes/no)"
read INSTALL_WM
if [[ $INSTALL_WM == "yes" || $INSTALL_WM == "y" ]]; then
terminalEmulator paru
else
echo "${arrow} You chose: ${INSTALL_WM}"
fi
}
function withYay() {
echo "${arrow} Would you like to install utility apps? (picom, nitrogen, dmenu etc..): (yes/no)"
read INSTALL_UTILITY
if [[ $INSTALL_UTILITY == "yes" || $INSTALL_UTILITY == "y" ]]; then
echo "${arrow} Installing utility apps.."
/usr/bin/yay -S --skipreview rsync python psmisc xorg-xprop xorg-xwininfo ffmpeg wireless_tools amazon-corretto-11 \
pulseaudio pulseaudio-alsa alsa-utils brightnessctl nitrogen gnome-calendar dmenu rofi xfce4-power-manager \
lxappearance lxsession xautolock xclip flameshot jome-git volumeicon xfce4-notifyd polkit-gnome ffmpegthumbnailer \
tumbler viewnior mpv mpd mpc ncmpcpp trayer network-manager-applet pavucontrol parcellite neofetch htop picom-git gtk2-perl playerctl xsettingsd
else
echo "${arrow} You chose: ${INSTALL_UTILITY}"
fi
rsync -avxRHAXP .oh-my-zsh/ .config/picom/ .zshrc .Xresources ~/
echo "${arrow} Let's check if I am running the script, will copy personal stuff (gitconfig etc.). Are you ${bold}alcadramin${normal}? (yes/no)"
read alcadramin
if [[ $alcadramin == "yes" || $alcadramin == "y" ]]; then
echo "${arrow} Copying personal stuff.."
rsync -avxRHAXP .gitconfig .xprofile .config/xrandr.sh .profile ~/
fi
echo "${arrow} Would you like to install window manager and setup the dotfiles? (yes/no)"
read INSTALL_WM
if [[ $INSTALL_WM == "yes" || $INSTALL_WM == "y" ]]; then
windowManager yay
else
echo "${arrow} You chose: ${INSTALL_WM}"
fi
echo "${arrow} Would you like to install terminal emulator and setup the dotfiles? (yes/no)"
read INSTALL_WM
if [[ $INSTALL_WM == "yes" || $INSTALL_WM == "y" ]]; then
terminalEmulator yay
else
echo "${arrow} You chose: ${INSTALL_WM}"
fi
}
function withApt() {
echo "${arrow} Would you like to install utility apps? (picom, nitrogen, dmenu etc..): (yes/no)"
read INSTALL_UTILITY
if [[ $INSTALL_UTILITY == "yes" || $INSTALL_UTILITY == "y" ]]; then
echo "${arrow} Installing utility apps.."
/usr/bin/sudo /usr/bin/apt install --skipreview rsync python psmisc x11-utils ffmpeg wireless_tools \
pulseaudio alsa-utils brightnessctl nitrogen gnome-calendar dmenu rofi xfce4-power-manager \
lxappearance lxpolkit xautolock xclip flameshot volumeicon xfce4-notifyd ffmpegthumbnailer \
tumbler viewnior mpv mpd mpc ncmpcpp trayer network-manager-gnome pavucontrol parcellite neofetch htop picom gtk2-perl playerctl xsettingsd
else
echo "${arrow} You chose: ${INSTALL_UTILITY}"
fi
rsync -avxRHAXP .oh-my-zsh/ .config/picom/ .zshrc .Xresources ~/
echo "${arrow} Let's check if I am running the script, will copy personal stuff (gitconfig etc.). Are you ${bold}alcadramin${normal}? (yes/no)"
read alcadramin
if [[ $alcadramin == "yes" || $alcadramin == "y" ]]; then
echo "${arrow} Copying personal stuff.."
rsync -avxRHAXP .gitconfig .xprofile .config/xrandr.sh .profile ~/
fi
echo "${arrow} Would you like to install window manager and setup the dotfiles? (yes/no)"
read INSTALL_WM
if [[ $INSTALL_WM == "yes" || $INSTALL_WM == "y" ]]; then
windowManager apt
else
echo "${arrow} You chose: ${INSTALL_WM}"
fi
echo "${arrow} Would you like to install terminal emulator and setup the dotfiles? (yes/no)"
read INSTALL_WM
if [[ $INSTALL_WM == "yes" || $INSTALL_WM == "y" ]]; then
terminalEmulator apt
else
echo "${arrow} You chose: ${INSTALL_WM}"
fi
}
function windowManager() {
pkgMan=$1
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Window Manager"
TITLE="Which window manager would you like to install?"
MENU="Choose one of the following options:"
OPTIONS=(1 "Xmonad with Xmobar"
2 "Qtile"
3 "Spectrwm")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
echo "${arrow} You chose Xmonad & Xmobar.. Starting installation and copying dotfiles & themes.."
if [[ $pkgMan == "apt" ]]; then
/usr/bin/sudo /usr/bin/$pkgMan install xmonad xmonad-contrib xmobar
else
/usr/bin/$pkgMan -S xmonad xmonad-contrib xmobar
fi
rsync -avxRHAXP .xmonad/ .config/xmobar/ .themes/ .local/ ~/
echo "${arrow} Job completed. Please edit dotfiles accordingly to your system. You can run this script again to install other WM's.."
exit 1
;;
2)
echo "You chose Qtile.. Starting installation and copying dotfiles & themes.."
if [[ $pkgMan == "apt" ]]; then
/usr/bin/sudo /usr/bin/$pkgMan install qtile
else
/usr/bin/$pkgMan -S qtile
fi
rsync -avxRHAXP .config/qtile/ .themes/ .local/ ~/
echo "${arrow} Job completed. Please edit dotfiles accordingly to your system. You can run this script again to install other WM's.."
exit 1
;;
3)
echo "You chose Spectrwm.. Starting installation and copying dotfiles & themes.."
if [[ $pkgMan == "apt" ]]; then
/usr/bin/sudo /usr/bin/$pkgMan install spectrwm
else
/usr/bin/$pkgMan -S spectrwm
fi
rsync .spectrwm.conf baraction.sh ~/
echo "${arrow} Job completed. Please edit dotfiles accordingly to your system. You can run this script again to install other WM's.."
exit 1
;;
*)
echo "${arrow} Exiting.."
exit 1
;;
esac
}
function terminalEmulator() {
pkgMan=$1
HEIGHT=15
WIDTH=40
CHOICE_HEIGHT=4
BACKTITLE="Terminal Emulator"
TITLE="Which terminal emulator would you like to install?"
MENU="Choose one of the following options:"
OPTIONS=(1 "Alacritty"
2 "Termite")
CHOICE=$(dialog --clear \
--backtitle "$BACKTITLE" \
--title "$TITLE" \
--menu "$MENU" \
$HEIGHT $WIDTH $CHOICE_HEIGHT \
"${OPTIONS[@]}" \
2>&1 >/dev/tty)
clear
case $CHOICE in
1)
echo "${arrow} You chose Alacritty.. Starting installation and copying dotfiles.."
if [[ $pkgMan == "apt" ]]; then
/usr/bin/sudo /usr/bin/$pkgMan install alacritty
else
/usr/bin/$pkgMan -S alacritty
fi
rsync -avxRHAXP .config/alacritty.yml ~/
echo "${arrow} Job completed. Please edit dotfiles accordingly to your system. You can run this script again to install other terminal emulators.."
exit 1
;;
2)
echo "You chose Termite.. Starting installation and copying dotfiles.."
if [[ $pkgMan == "apt" ]]; then
/usr/bin/sudo /usr/bin/$pkgMan install termite
else
/usr/bin/$pkgMan -S termite
fi
rsync -avxRHAXP .config/termite/ .local/ ~/
echo "${arrow} Job completed. Please edit dotfiles accordingly to your system. You can run this script again to install other terminal emulators.."
exit 1
;;
*)
echo "${arrow} Exiting.."
exit 1
;;
esac
}
function _backup() {
echo "${arrow} Not implemented yet."
}
case "$#" in
0)
_help
;;
1)
case "$1" in
-h | --help | help)
_help
;;
-i | --install | install)
_init
_install
;;
-b | --backup | backup)
_init
_backup
;;
*)
echo "Input error."
exit 1
;;
esac
;;
*)
echo "Input error, too many arguments."
exit 1
;;
esac