-
Notifications
You must be signed in to change notification settings - Fork 65
/
setup.sh
281 lines (250 loc) · 9.57 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
#!/usr/bin/bash
# Author: Juan Rivas (aka @r1vs3c)
# Colours
greenColour="\e[0;32m\033[1m"
endColour="\033[0m\e[0m"
redColour="\e[0;31m\033[1m"
blueColour="\e[0;34m\033[1m"
yellowColour="\e[0;33m\033[1m"
purpleColour="\e[0;35m\033[1m"
turquoiseColour="\e[0;36m\033[1m"
grayColour="\e[0;37m\033[1m"
# Global variables
dir=$(pwd)
fdir="$HOME/.local/share/fonts"
user=$(whoami)
trap ctrl_c INT
function ctrl_c(){
echo -e "\n\n${redColour}[!] Exiting...\n${endColour}"
exit 1
}
function banner(){
echo -e "\n${turquoiseColour} _____ ______"
sleep 0.05
echo -e "______ ____ ___ /______ ___ /___________________ ________ ___"
sleep 0.05
echo -e "_ __ \`/ / / / __/ __ \ __ __ \_ ___/__ __ \_ | /| / /_ __ \`__ \\"
sleep 0.05
echo -e "/ /_/ // /_/ // /_ / /_/ / _ /_/ /(__ )__ /_/ /_ |/ |/ /_ / / / / /"
sleep 0.05
echo -e "\__,_/ \__,_/ \__/ \____/ /_.___//____/ _ .___/____/|__/ /_/ /_/ /_/ ${endColour}${yellowColour}(${endColour}${grayColour}By ${endColour}${purpleColour}@r1vs3c${endColour}${yellowColour})${endColour}${turquoiseColour}"
sleep 0.05
echo -e " /_/${endColour}"
}
if [ "$user" == "root" ]; then
banner
echo -e "\n\n${redColour}[!] You should not run the script as the root user!\n${endColour}"
exit 1
else
banner
sleep 1
echo -e "\n\n${blueColour}[*] Installing necessary packages for the environment...\n${endColour}"
sleep 2
sudo apt install -y kitty rofi feh xclip ranger i3lock-fancy scrot scrub wmname imagemagick cmatrix htop neofetch python3-pip procps tty-clock fzf lsd bat pamixer flameshot
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install some packages!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
echo -e "\n${blueColour}[*] Starting installation of necessary dependencies for the environment...\n${endColour}"
sleep 0.5
echo -e "\n${purpleColour}[*] Installing necessary dependencies for bspwm...\n${endColour}"
sleep 2
sudo apt install -y build-essential git vim libxcb-util0-dev libxcb-ewmh-dev libxcb-randr0-dev libxcb-icccm4-dev libxcb-keysyms1-dev libxcb-xinerama0-dev libasound2-dev libxcb-xtest0-dev libxcb-shape0-dev libuv1-dev
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install some dependencies for bspwm!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
echo -e "\n${purpleColour}[*] Installing necessary dependencies for polybar...\n${endColour}"
sleep 2
sudo apt install -y cmake cmake-data pkg-config python3-sphinx libcairo2-dev libxcb1-dev libxcb-util0-dev libxcb-randr0-dev libxcb-composite0-dev python3-xcbgen xcb-proto libxcb-image0-dev libxcb-ewmh-dev libxcb-icccm4-dev libxcb-xkb-dev libxcb-xrm-dev libxcb-cursor-dev libasound2-dev libpulse-dev libjsoncpp-dev libmpdclient-dev libcurl4-openssl-dev libnl-genl-3-dev
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install some dependencies for polybar!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
echo -e "\n${purpleColour}[*] Installing necessary dependencies for picom...\n${endColour}"
sleep 2
sudo apt install -y meson libxext-dev libxcb1-dev libxcb-damage0-dev libxcb-xfixes0-dev libxcb-shape0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-randr0-dev libxcb-composite0-dev libxcb-image0-dev libxcb-present-dev libxcb-xinerama0-dev libpixman-1-dev libdbus-1-dev libconfig-dev libgl1-mesa-dev libpcre2-dev libpcre3-dev libevdev-dev uthash-dev libev-dev libx11-xcb-dev libxcb-glx0-dev
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install some dependencies for picom!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
echo -e "\n${blueColour}[*] Starting installation of the tools...\n${endColour}"
sleep 0.5
mkdir ~/tools && cd ~/tools
echo -e "\n${purpleColour}[*] Installing bspwm...\n${endColour}"
sleep 2
git clone https://github.com/baskerville/bspwm.git
cd bspwm
make -j$(nproc)
sudo make install
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install bspwm!\n${endColour}"
exit 1
else
sudo apt install bspwm -y
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
cd ..
echo -e "\n${purpleColour}[*] Installing sxhkd...\n${endColour}"
sleep 2
git clone https://github.com/baskerville/sxhkd.git
cd sxhkd
make -j$(nproc)
sudo make install
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install sxhkd!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
cd ..
echo -e "\n${purpleColour}[*] Installing polybar...\n${endColour}"
sleep 2
git clone --recursive https://github.com/polybar/polybar
cd polybar
mkdir build
cd build
cmake ..
make -j$(nproc)
sudo make install
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install polybar!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
cd ../../
echo -e "\n${purpleColour}[*] Installing picom...\n${endColour}"
sleep 2
git clone https://github.com/ibhagwan/picom.git
cd picom
git submodule update --init --recursive
meson --buildtype=release . build
ninja -C build
sudo ninja -C build install
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install picom!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
cd ..
echo -e "\n${purpleColour}[*] Installing Oh My Zsh and Powerlevel10k for user $user...\n${endColour}"
sleep 2
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install Oh My Zsh and Powerlevel10k for user $user!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
echo -e "\n${purpleColour}[*] Installing Oh My Zsh and Powerlevel10k for user root...\n${endColour}"
sleep 2
sudo sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
sudo git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /root/.oh-my-zsh/custom/themes/powerlevel10k
if [ $? != 0 ] && [ $? != 130 ]; then
echo -e "\n${redColour}[-] Failed to install Oh My Zsh and Powerlevel10k for user root!\n${endColour}"
exit 1
else
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
fi
echo -e "\n${blueColour}[*] Starting configuration of fonts, wallpaper, configuration files, .zshrc, .p10k.zsh, and scripts...\n${endColour}"
sleep 0.5
echo -e "\n${purpleColour}[*] Configuring fonts...\n${endColour}"
sleep 2
if [[ -d "$fdir" ]]; then
cp -rv $dir/fonts/* $fdir
else
mkdir -p $fdir
cp -rv $dir/fonts/* $fdir
fi
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${purpleColour}[*] Configuring wallpaper...\n${endColour}"
sleep 2
if [[ -d "~/Wallpapers" ]]; then
cp -rv $dir/wallpapers/* ~/Wallpapers
else
mkdir ~/Wallpapers
cp -rv $dir/wallpapers/* ~/Wallpapers
fi
wal -nqi ~/Wallpapers/archkali.png
sudo wal -nqi ~/Wallpapers/archkali.png
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${purpleColour}[*] Configuring configuration files...\n${endColour}"
sleep 2
cp -rv $dir/config/* ~/.config/
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${purpleColour}[*] Configuring the .zshrc and .p10k.zsh files...\n${endColour}"
sleep 2
cp -v $dir/.zshrc ~/.zshrc
sudo ln -sfv ~/.zshrc /root/.zshrc
cp -v $dir/.p10k.zsh ~/.p10k.zsh
sudo ln -sfv ~/.p10k.zsh /root/.p10k.zsh
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${purpleColour}[*] Configuring scripts...\n${endColour}"
sleep 2
sudo cp -v $dir/scripts/whichSystem.py /usr/local/bin/
cp -rv $dir/scripts/*.sh ~/.config/polybar/shapes/scripts/
touch ~/.config/polybar/shapes/scripts/target
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${purpleColour}[*] Configuring necessary permissions and symbolic links...\n${endColour}"
sleep 2
chmod -R +x ~/.config/bspwm/
chmod +x ~/.config/polybar/launch.sh
chmod +x ~/.config/polybar/shapes/scripts/*
sudo chmod +x /usr/local/bin/whichSystem.py
sudo chmod +x /usr/local/share/zsh/site-functions/_bspc
sudo chown root:root /usr/local/share/zsh/site-functions/_bspc
sudo mkdir -p /root/.config/polybar/shapes/scripts/
sudo touch /root/.config/polybar/shapes/scripts/target
sudo ln -sfv ~/.config/polybar/shapes/scripts/target /root/.config/polybar/shapes/scripts/target
cd ..
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${purpleColour}[*] Removing repository and tools directory...\n${endColour}"
sleep 2
rm -rfv ~/tools
rm -rfv $dir
echo -e "\n${greenColour}[+] Done\n${endColour}"
sleep 1.5
echo -e "\n${greenColour}[+] Environment configured :D\n${endColour}"
sleep 1.5
while true; do
echo -en "\n${yellowColour}[?] It's necessary to restart the system. Do you want to restart the system now? ([y]/n) ${endColour}"
read -r
REPLY=${REPLY:-"y"}
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "\n\n${greenColour}[+] Restarting the system...\n${endColor}"
sleep 1
sudo reboot
elif [[ $REPLY =~ ^[Nn]$ ]]; then
exit 0
else
echo -e "\n${redColour}[!] Invalid response, please try again\n${endColour}"
fi
done
fi