-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·220 lines (185 loc) · 6.26 KB
/
install
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
#!/bin/bash
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 ""
printf '%s[%s%s %s%s %s]%s\n\n' "${CRE}" "${CNC}" "${CYE}" "${text}"
}
# Check if this script is run as root
if [ "$(id -u)" = 0 ]; then
echo "This script MUST NOT be run as root."
exit 1
fi
# Intro
clear
logo "Welcome!"
printf '%s%sThis script will automatically install fully-featured tiling/floating window manager-based system on any Arch Linux or Arch-based system. \nMy dotfiles DO NOT modify any of your system configuration. \nYou will be prompted for your root password to install missing dependencies \nThis script doesnt have potential power to break your system, it only copies files from my repo to your HOME directory. %s\n\n' "${BLD}" "${CRE}" "${CNC}"
while true; do
read -rp " Do you want to continue? [y/n]: " yn
case $yn in
[Yy]*) break ;;
[Nn]*) exit ;;
*) printf "Just write 'y' or 'n'\n\n" ;;
esac
done
clear
# Update system
logo "Updating system"
sudo rm -rf /var/lib/pacman/db.lck
sudo pacman -Syu --noconfirm
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Install X.Org
logo "Installing X.Org"
sudo pacman -S --needed --noconfirm xorg xorg-drivers
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Install Pipewire (audio)
logo "Installing Pipewire (audio)"
yes y | sudo pacman -S --needed pipewire pipewire-pulse wireplumber
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Install Yay (AUR helper)
logo "Installing yay"
if command -v yay &>/dev/null; then
echo "Yay is installed in your system"
else
sudo pacman -S --needed --noconfirm git base-devel && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm && cd ..
fi
sleep 2
clear
# Install packages
logo "Installing needed packages"
dependencies=(kitty bspwm dunst feh gtk-engine-murrine gvfs gvfs-afc gvfs-mtp gvfs-smb htop zsh fastfetch lxappearance-gtk3 mpv neovim networkmanager pamixer pavucontrol qogir-icon-theme rofi scrot sed sxhkd udisks2 ttf-roboto-mono ttf-roboto-mono-nerd ttf-ubuntu-font-family noto-fonts-emoji imagemagick ttf-jetbrains-mono-nerd ttf-jetbrains-mono ttf-maple unzip xdg-user-dirs-gtk xorg-xinit zathura zathura-pdf-mupdf pactl alsa-utils xclip sweet-gtk-theme-dark bibata-cursor-theme yazi zen-browser-avx2-bin)
is_installed() {
pacman -Qi "$1" &>/dev/null
return $?
}
printf "%s%sChecking for required packages%s\n" "${BLD}" "${CBL}" "${CNC}"
for paquete in "${dependencies[@]}"; do
if ! is_installed "$paquete"; then
yay -S --noconfirm --needed "$paquete"
printf "\n"
else
printf '%s%s is already installed on your system!%s\n' "${CGR}" "$paquete" "${CNC}"
fi
done
sleep 2
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
# Downloading dotfiles
logo "Downloading dotfiles"
[ -d ~/dotfiles ] && rm -rf ~/dotfiles
printf "Cloning rice from https://github.com/xArcGit/dotfiles\n"
cd
git clone --depth=1 https://github.com/xArcGit/dotfiles.git
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Backup dotfiles
logo "Backing-up dotfiles"
printf "Backup files will be stored in %s%s%s/.RiceBackup%s \n\n" "${BLD}" "${CRE}" "$HOME" "${CNC}"
sleep 1
if [ ! -d "$backup_folder" ]; then
mkdir -p "$backup_folder"
fi
# Backup configuration folders and individual files
for item in bspwm htop kitty mpv fastfetch paru bat gtk-3.0 gtk-4.0 nvim yazi yay zathura; do
if [ -d "$HOME/.config/$item" ]; then
mv "$HOME/.config/$item" "$backup_folder/${item}_$date"
echo "$item folder backed up successfully at $backup_folder/${item}_$date"
elif [ -f "$HOME/.config/$item" ]; then
mv "$HOME/.config/$item" "$backup_folder/${item}_$date"
echo "$item file backed up successfully at $backup_folder/${item}_$date"
else
echo "The item $item does not exist in $HOME/.config/"
fi
done
# Backup specific files in home directory
for file in .fehbg .zshrc .xinitrc .Xresources .gtkrc-2.0 .bg.png .zsh; do
if [ -f "$HOME/$file" ]; then
mv "$HOME/$file" "$backup_folder/${file}-backup-$date"
echo "$file backed up successfully at $backup_folder/${file}-backup-$date"
else
echo "$file does not exist in $HOME"
fi
done
printf "%s%sDone!!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Installing dotfiles
logo "Installing dotfiles.."
printf "Copying files to respective directories..\n"
[ ! -d ~/.config ] && mkdir -p ~/.config
[ ! -d ~/.fonts ] && mkdir -p ~/.fonts
for archivos in ~/dotfiles/config/*; do
cp -R "${archivos}" ~/.config/
if [ $? -eq 0 ]; then
printf "%s%s%s folder copied successfully!%s\n" "${BLD}" "${CGR}" "${archivos}" "${CNC}"
else
printf "%s%s%s failed to be copied, you must copy it manually%s\n" "${BLD}" "${CRE}" "${archivos}" "${CNC}"
sleep 1
fi
done
for file in .fehbg .zshrc .xinitrc .Xresources .gtkrc-2.0 .bg.png; do
if [ -f "$HOME/dotfiles/$file" ]; then
cp -f "$HOME/dotfiles/$file" "$HOME"
echo "$file copied successfully to $HOME"
else
echo "$file does not exist in $HOME/dotfiles/"
fi
done
printf "%s%sDone!\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Configuring dotfiles
logo "Configuring dotfiles"
chmod -R +x ~/.config/
chmod +x ~/.xinitrc
printf "%s%sDone!\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Configuring pacman (for what???)
logo "Configuring pacman (for what???)"
grep "^Color" /etc/pacman.conf >/dev/null || sudo sed -i "s/^#Color$/Color/" /etc/pacman.conf
grep "ILoveCandy" /etc/pacman.conf >/dev/null || sudo sed -i "/#VerbosePkgLists/a ILoveCandy" /etc/pacman.conf
printf "%s%sDone!\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Enabling services
logo "Enabling services"
sudo systemctl enable NetworkManager
systemctl --user enable pipewire pipewire-pulse wireplumber
printf "%s%sDone!%s\n\n" "${BLD}" "${CGR}" "${CNC}"
sleep 2
clear
# Restart
logo "Done!"
printf "%s%sThanks for using my config! %s\n" "${BLD}" "${CYE}" "${CNC}"
while true; do
read -rp "Do you want to restart now? [y/n]: " yn
case $yn in
[Yy]*) reboot ;;
[Nn]*) exit ;;
*) printf "Just write 'y' or 'n'\n\n" ;;
esac
done