forked from gh0stzk/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RiceInstaller
executable file
·196 lines (164 loc) · 6.47 KB
/
RiceInstaller
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
#!/usr/bin/env bash
# Script to install my dotfiles
# Author: z0mbi3
# url: https://github.com/gh0stzk
CRE=$(tput setaf 1)
CYE=$(tput setaf 3)
CGR=$(tput setaf 2)
CBL=$(tput setaf 4)
BLD=$(tput bold)
CNC=$(tput sgr0)
OK='\n\033[0;32m OK...\033[0m'
logo () {
local text="${1:?}"
echo -en "
%%%
%%%%%//%%%%%
%%************%%%
(%%//############*****%%
%%%%%**###&&&&&&&&&###**//
%%(**##&&&#########&&&##**
%%(**##*****#####*****##**%%%
%%(**## ***** ##**
//## @@** @@ ##//
## **### ##
####### #####//
###**&&&&&**###
&&& &&&
&&&//// &&
&&//@@@**
..***
z0mbi3 Script\n\n"
printf ' %s [%s%s %s%s %s]%s\n\n' "${CRE}" "${CNC}" "${CYE}" "${text}" "${CNC}" "${CRE}" "${CNC}"
sleep 2
}
logo "Welcome!"
printf '%sThis script will install needed dependencies and copy my dotfiles to your bspwm setup.%s\n\nThis installer script does NOT change any configuration of your system.\nIts just a script that copies and moves my dotfiles to your ~/.config directory\n\n' "${CRE}" "${CNC}"
sleep 5
while true; do
read -rp " Do you wish to continue? [y/N]: " yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) printf " Error: just write 'y' or 'n'\n\n";;
esac
done
clear
logo "Installing needed packages.."
dependencias=(base-devel bspwm polybar sxhkd alacritty dunst rofi lsd jq polkit-gnome git playerctl mpd ncmpcpp geany ranger mpc picom feh ueberzug maim pamixer libwebp webp-pixbuf-loader xorg-xprop xorg-xkill papirus-icon-theme ttf-jetbrains-mono ttf-jetbrains-mono-nerd ttf-terminus-nerd ttf-inconsolata ttf-joypixels zsh)
is_installed() {
pacman -Qi $1 &> /dev/null
return $?
}
printf "%s%sChecking for required packages...%s\n" "${BLD}" "${CBL}" "${CNC}"
for paquete in "${dependencias[@]}"
do
if ! is_installed $paquete; then
sudo pacman -S $paquete --noconfirm
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${CGR}" "$paquete" "${CNC}"
sleep 1
fi
done
sleep 2
clear
logo "Checking if yay is installed"
if ! command -v yay &>/dev/null; then
printf "%s%sError YAY is not installed%s\n" "${BLD}" "${CRE}" "${CNC}"
sleep 1
printf "%s%sInstalling YAY..%s\n\n" "${BLD}" "${CYE}" "${CNC}"
sleep 1
git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si && cd && rm -rf yay
else
printf "%s%sYAY is already installed on your system%s\n" "${BLD}" "${CGR}" "${CNC}"
fi
sleep 2
clear
logo "Installing needed packages from AUR"
yay -S eww termite xtitle checkupdates-aur betterlockscreen \
nerd-fonts-cozette-ttf scientifica-font --noconfirm --removemake --cleanafter
sleep 2
clear
logo "Cloning Rice!"
printf "Cloning rice from https://github.com/gh0stzk/dotfiles\n\n"
git clone --depth=1 https://github.com/gh0stzk/dotfiles.git
sleep 2
clear
logo "Backup your files"
printf "Backup files will be stored in %s%s%s/.RiceBackup%s \n\n" "${BLD}" "${CRE}" "$HOME" "${CNC}"
sleep 5
if [ ! -d "$HOME/.RiceBackup" ]; then
mkdir "${HOME}"/.RiceBackup
fi
[ -e ~/.config/bspwm ] && mv ~/.config/bspwm ~/.RiceBackup/bspwm-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/termite ] && mv ~/.config/termite ~/.RiceBackup/termite-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/alacritty ] && mv ~/.config/alacritty ~/.RiceBackup/alacritty-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/picom ] && mv ~/.config/picom ~/.RiceBackup/picom-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/rofi ] && mv ~/.config/rofi ~/.RiceBackup/rofi-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/eww ] && mv ~/.config/eww ~/.RiceBackup/eww-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/sxhkd ] && mv ~/.config/sxhkd ~/.RiceBackup/sxhkd-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/dunst ] && mv ~/.config/dunst ~/.RiceBackup/dunst-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/gtk-3.0 ] && mv ~/.config/gtk-3.0 ~/.RiceBackup/gtk-3.0-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/mpd ] && mv ~/.config/mpd ~/.RiceBackup/mpd-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/ncmpcpp ] && mv ~/.config/ncmpcpp ~/.RiceBackup/ncmpcpp-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/nvim ] && mv ~/.config/nvim ~/.RiceBackup/nvim-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/ranger ] && mv ~/.config/ranger ~/.RiceBackup/ranger-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -e ~/.config/zsh ] && mv ~/.config/zsh ~/.RiceBackup/zsh-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
[ -f ~/.zshrc ] && mv ~/.zshrc ~/.RiceBackup/.zshrc-backup-"$(date +%Y.%m.%d-%H.%M.%S)"
printf "%s%sDone!!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
logo "Copying Rice.."
printf "Copying files to respective directories..\n"
if [ ! -d $HOME/.config ]; then
mkdir -p $HOME/.config
cp -r $HOME/dotfiles/config/* $HOME/.config
else
cp -r $HOME/dotfiles/config/* $HOME/.config
fi
if [ ! -d $HOME/.local/bin ]; then
mkdir -p $HOME/.local/bin
cp -r $HOME/dotfiles/misc/bin/* $HOME/.local/bin
else
cp -r $HOME/dotfiles/misc/bin/* $HOME/.local/bin
fi
if [ ! -d $HOME/.local/share/applications ]; then
mkdir -p $HOME/.local/share/applications
cp -r $HOME/dotfiles/misc/applications/* $HOME/.local/share/applications
else
cp -r $HOME/dotfiles/misc/applications/* $HOME/.local/share/applications
fi
if [ ! -d $HOME/.local/share/asciiart ]; then
mkdir -p $HOME/.local/share/asciiart
cp -r $HOME/dotfiles/misc/asciiart/* $HOME/.local/share/asciiart
else
cp -r $HOME/dotfiles/misc/asciiart/* $HOME/.local/share/asciiart
fi
if [ ! -d $HOME/.local/share/fonts ]; then
mkdir -p $HOME/.local/share/fonts
cp -r $HOME/dotfiles/misc/fonts/* $HOME/.local/share/fonts
else
cp -r $HOME/dotfiles/misc/fonts/* $HOME/.local/share/fonts
fi
cp -r $HOME/dotfiles/misc/firefox/chrome $HOME/.mozilla/firefox/*.default-release/
cp -r $HOME/dotfiles/misc/firefox/user.js $HOME/.mozilla/firefox/*.default-release/
cp -r $HOME/dotfiles/home/.zshrc $HOME
printf "%s%sFiles copied succesfully!!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
logo "Reloading fonts.."
fc-cache -rv >/dev/null 2>&1
printf "%s%sFonts reloaded succesfully!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
logo "Enabling MPD service"
systemctl --user enable mpd.service
systemctl --user start mpd.service
printf "%s%sDone!!%s\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
logo "Installation finished"
printf "%s%sNow logout your session, select bspwm and log in.%s\n\n" "${BLD}" "${CRE}" "${CNC}"
chsh -s /usr/bin/zsh
zsh