-
Notifications
You must be signed in to change notification settings - Fork 1
/
ExquisiteInstaller
executable file
·335 lines (277 loc) · 12.9 KB
/
ExquisiteInstaller
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
#!/usr/bin/env bash
# ╭━━╮╱╱╱╱╱╭╮╱╱╱╭╮╭╮╱╱╱╱╱╱╱╱╱╱╱╱╱╭╮
# ╰┫┣╯╱╱╱╱╭╯╰╮╱╱┃┃┃┃╱╱╱╱╱╱╱╱╱╱╱╱╭╯╰╮
# ╱┃┃╭━╮╭━┻╮╭╋━━┫┃┃┃╱╭━━┳━━┳━┳┳━┻╮╭╯
# ╱┃┃┃╭╮┫━━┫┃┃╭╮┃┃┃┃╱┃━━┫╭━┫╭╋┫╭╮┃┃
# ╭┫┣┫┃┃┣━━┃╰┫╭╮┃╰┫╰╮┣━━┃╰━┫┃┃┃╰╯┃╰╮
# ╰━━┻╯╰┻━━┻━┻╯╰┻━┻━╯╰━━┻━━┻╯╰┫╭━┻━╯
# ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃
# ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯
# Exquisite Configs
# github.com/ejsadiarin/dotfiles
#
# special thanks to gh0stzk for bootstraping the scripts and rices
CRE=$(tput setaf 1)
CYE=$(tput setaf 3)
CGR=$(tput setaf 2)
CBL=$(tput setaf 4)
BLD=$(tput bold)
CNC=$(tput sgr0)
backup_folder=~/.RiceBackup
date=$(date +%Y%m%d-%H%M%S)
logo() {
local text="${1:?}"
echo -en "
███████╗██╗░░██╗░██████╗░██╗░░░██╗██╗░██████╗██╗████████╗███████╗
██╔════╝╚██╗██╔╝██╔═══██╗██║░░░██║██║██╔════╝██║╚══██╔══╝██╔════╝
█████╗░░░╚███╔╝░██║██╗██║██║░░░██║██║╚█████╗░██║░░░██║░░░█████╗░░
██╔══╝░░░██╔██╗░╚██████╔╝██║░░░██║██║░╚═══██╗██║░░░██║░░░██╔══╝░░
███████╗██╔╝╚██╗░╚═██╔═╝░╚██████╔╝██║██████╔╝██║░░░██║░░░███████╗
╚══════╝╚═╝░░╚═╝░░░╚═╝░░░░╚═════╝░╚═╝╚═════╝░╚═╝░░░╚═╝░░░╚══════╝
░█████╗░░█████╗░███╗░░██╗███████╗██╗░██████╗░░██████╗
██╔══██╗██╔══██╗████╗░██║██╔════╝██║██╔════╝░██╔════╝
██║░░╚═╝██║░░██║██╔██╗██║█████╗░░██║██║░░██╗░╚█████╗░
██║░░██╗██║░░██║██║╚████║██╔══╝░░██║██║░░╚██╗░╚═══██╗
╚█████╔╝╚█████╔╝██║░╚███║██║░░░░░██║╚██████╔╝██████╔╝
░╚════╝░░╚════╝░╚═╝░░╚══╝╚═╝░░░░░╚═╝░╚═════╝░╚═════╝░
The Most Exquisite Dotfiles in the Universe\n\n"
printf ' %s [%s%s %s%s %s]%s\n\n' "${CRE}" "${CNC}" "${CYE}" "${text}" "${CNC}" "${CRE}" "${CNC}"
}
########## ---------- You must not run this as root ---------- ##########
if [ "$(id -u)" = 0 ]; then
echo "This script MUST NOT be run as root user."
exit 1
fi
########## ---------- Welcome ---------- ##########
logo "Welcome!"
printf '%s%sThis script will check if you have the necessary dependencies, and if not, it will install them. Then, it will clone the RICE in your HOME directory.\nAfter that, it will create a secure backup of your files, and then copy the new files to your computer.\n\nMy dotfiles DO NOT modify any of your system configurations.\nYou will be prompted for your root password to install missing dependencies and/or to switch to zsh shell if its not your default.\n\nThis script doesnt have the potential power to break your system, it only copies files from my repository to your HOME directory.%s\n\n' "${BLD}" "${CRE}" "${CNC}"
while true; do
read -rp " Do you wish to continue? [y/N]: " yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) printf " Error: only write 'y' or 'n'\n\n" ;;
esac
done
clear
########## ---------- Install packages ---------- ##########
logo "Initializing perfection..."
dependencies=(base-devel rustup pacman-contrib bspwm polybar sxhkd
alacritty brightnessctl dunst rofi lsd stalonetray auto-cpufreq
jq polkit-gnome git playerctl mpd xclip copyq redshift
ncmpcpp geany ranger mpc picom xdo xdotool jgmenu shotwell
feh ueberzug maim pamixer libwebp xdg-user-dirs
webp-pixbuf-loader xorg-xprop xorg-xkill physlock papirus-icon-theme
ttf-jetbrains-mono ttf-jetbrains-mono-nerd ttf-terminus-nerd ttf-inconsolata ttf-joypixels
zsh zsh-autosuggestions zsh-history-substring-search zsh-syntax-highlighting xorg-xsetroot xorg-xwininfo xorg-xrandr)
is_installed() {
pacman -Qi "$1" &>/dev/null
return $?
}
printf "%s%sChecking for required packages...%s\n" "${BLD}" "${CBL}" "${CNC}"
for packages in "${dependencies[@]}"; do
if ! is_installed "$packages"; then
sudo pacman -S "$packages" --noconfirm
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${CGR}" "$packages" "${CNC}"
sleep 1
fi
done
sleep 3
clear
########## ---------- Preparing Folders ---------- ##########
logo "Preparing Folders..."
if [ ! -e $HOME/.config/user-dirs.dirs ]; then
xdg-user-dirs-update
echo "Creating xdg-user-dirs"
else
echo "user-dirs.dirs already exists"
fi
sleep 2
clear
########## ---------- Cloning the Rice! ---------- ##########
logo "Downloading dotfiles..."
# repo_url="https://github.com/gh0stzk/dotfiles"
repo_url="https://github.com/ejsadiarin/dotfiles"
repo_dir="$HOME/dotfiles"
# [ -d ~/dotfiles ] && rm -rf ~/dotfiles
# printf "Cloning rice from https://github.com/ejsadiarin/dotfiles\n"
# cd
# git clone --depth=1 https://github.com/ejsadiarin/dotfiles.git
if [ -d "$repo_dir" ]; then
printf "Removing existing dotfiles repository\n"
rm -rf "$repo_dir"
fi
printf "Cloning dotfiles from %s\n" "$repo_url"
git clone --depth=1 "$repo_url" "$repo_dir"
sleep 2
clear
########## ---------- Backup files ---------- ##########
logo "Executing file backups..."
printf "Backup files will be stored in %s%s%s/.RiceBackup%s \n\n" "${BLD}" "${CRE}" "$HOME" "${CNC}"
sleep 10
if [ ! -d "$backup_folder" ]; then
mkdir -p "$backup_folder"
fi
for folder in bspwm alacritty picom rofi eww sxhkd dunst polybar ncmpcpp nvim ranger zsh mpd paru; do
if [ -d "$HOME/.config/$folder" ]; then
mv "$HOME/.config/$folder" "$backup_folder/${folder}_$date"
echo "$folder folder backed up successfully at $backup_folder/${folder}_$date"
else
echo "The folder $folder does not exist in $HOME/.config/"
fi
done
for folder in chrome; do
if [ -d "$HOME"/.mozilla/firefox/*.default-release/$folder ]; then
mv "$HOME"/.mozilla/firefox/*.default-release/$folder "$backup_folder"/${folder}_$date
echo "$folder folder backed up successfully at $backup_folder/${folder}_$date"
else
echo "The folder $folder does not exist in $HOME/.mozilla/firefox/"
fi
done
for file in user.js; do
if [ -e "$HOME"/.mozilla/firefox/*.default-release/$file ]; then
mv "$HOME"/.mozilla/firefox/*.default-release/$file "$backup_folder"/${file}_$date
echo "$file file backed up successfully at $backup_folder/${file}_$date"
else
echo "The file $file does not exist in $HOME/.mozilla/firefox/"
fi
done
[ -f ~/.zshrc ] && mv ~/.zshrc ~/.RiceBackup/.zshrc-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 5
########## ---------- Copy the Rice! ---------- ##########
logo "Installing dotfiles..."
echo "Copying files to respective directories..."
[ ! -d ~/.config ] && mkdir -p ~/.config
[ ! -d ~/.local/bin ] && mkdir -p ~/.local/bin
[ ! -d ~/.local/share/applications ] && mkdir -p ~/.local/share/applications
[ ! -d ~/.local/share/fonts ] && mkdir -p ~/.local/share/fonts
for archivos in ~/dotfiles/config/*; do
cp -R "${archivos}" ~/.config/
if [ $? -eq 0 ]; then
printf "%s%s%s folder copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/misc/bin/*; do
cp -R "${archivos}" ~/.local/bin/
if [ $? -eq 0 ]; then
printf "%s%s%s file copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/misc/applications/*; do
cp -R "${archivos}" ~/.local/share/applications/
if [ $? -eq 0 ]; then
printf "%s%s%s file copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/misc/fonts/*; do
cp -R "${archivos}" ~/.local/share/fonts/
if [ $? -eq 0 ]; then
printf "%s%s%s copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for archivos in ~/dotfiles/misc/firefox/*; do
cp -R "${archivos}" ~/.mozilla/firefox/*.default-release/
if [ $? -eq 0 ]; then
printf "%s%s%s folder copied succesfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
sleep 1
else
printf "%s%s%s failed to been copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
cp -f "$HOME"/dotfiles/home/.zshrc "$HOME"
fc-cache -rv >/dev/null 2>&1
printf "%s%sFiles copied succesfully!!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 3
########## ---------- Installing Paru & Eww from source ---------- ##########
logo "installing Paru, Eww, tdrop & xqp"
# Installing Paru
if command -v paru >/dev/null 2>&1; then
printf "%s%sParu is already installed%s\n" "${BLD}" "${CGR}" "${CNC}"
else
printf "%s%sInstalling paru%s\n" "${BLD}" "${CBL}" "${CNC}"
{
cd "$HOME" || exit
git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin || exit
makepkg -si --noconfirm
} || {
printf "\n%s%sFailed to install Paru. You may need to install it manually%s\n" "${BLD}" "${CRE}" "${CNC}"
}
fi
# Intalling tdrop for scratchpads
if command -v tdrop >/dev/null 2>&1; then
printf "\n%s%sTdrop is already installed%s\n" "${BLD}" "${CGR}" "${CNC}"
else
printf "\n%s%sInstalling tdrop, this should be fast!%s\n" "${BLD}" "${CBL}" "${CNC}"
paru -S tdrop-git --skipreview --noconfirm
paru -S system-monitoring-center --skipreview --noconfirm
fi
# Intalling xqpp
if command -v xqp >/dev/null 2>&1; then
printf "\n%s%sxqp is already installed%s\n" "${BLD}" "${CGR}" "${CNC}"
else
printf "\n%s%sInstalling xqp, this should be fast!%s\n" "${BLD}" "${CBL}" "${CNC}"
paru -S xqp --skipreview --noconfirm
fi
# Installing Eww
if command -v eww >/dev/null 2>&1; then
printf "\n%s%sEww is already installed%s\n" "${BLD}" "${CGR}" "${CNC}"
else
printf "\n%s%sInstalling Eww, this could take 10 mins or more.%s\n" "${BLD}" "${CBL}" "${CNC}"
{
sudo pacman -S rustup --noconfirm
cd "$HOME" || exit
git clone https://github.com/elkowar/eww
cd eww || exit
cargo build --release --no-default-features --features x11
sudo install -m 755 "$HOME/eww/target/release/eww" -t /usr/bin/
} && {
cd "$HOME" || exit
rm -rf {paru-bin,.cargo,.rustup,eww}
} || {
printf "\n%s%sFailed to install Eww. You may need to install it manually%s\n" "${BLD}" "${CRE}" "${CNC}"
}
fi
########## ---------- Enabling MPD service ---------- ##########
logo "Enabling mpd service..."
if systemctl is-enabled --quiet mpd.service; then
printf "\n%s%sDisabling and stopping the global mpd service%s\n" "${BLD}" "${CBL}" "${CNC}"
sudo systemctl stop mpd.service
sudo systemctl disable mpd.service
fi
printf "\n%s%sEnabling and starting the user-level mpd service%s\n" "${BLD}" "${CYE}" "${CNC}"
systemctl --user enable --now mpd.service
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
########## --------- Changing shell to zsh ---------- ##########
logo "Changing default shell to zsh..."
if [[ $SHELL != "/usr/bin/zsh" ]]; then
printf "\n%s%sChanging your shell to zsh. Your root password is needed.%s\n\n" "${BLD}" "${CYE}" "${CNC}"
# Cambia la shell a zsh
chsh -s /usr/bin/zsh
printf "%s%sShell changed to zsh. Please reboot.%s\n\n" "${BLD}" "${CGR}" "${CNC}"
else
printf "%s%sYour shell is already zsh\nGood bye! installation finished, now reboot%s\n" "${BLD}" "${CGR}" "${CNC}"
fi
zsh
printf "%s%s\nInstallation finished...\n Welcome to the Most Exquisite Dotfiles in the Universe!\n\n Reboot system to initialize...%s\n" "${BLD}" "${CGR}" "${CNC}"