-
Notifications
You must be signed in to change notification settings - Fork 0
/
rice.sh
296 lines (259 loc) · 9.79 KB
/
rice.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
#!/bin/bash
# Useless script to rice your desktop
VERSION="v0.1"
clear
if [ "$EUID" -ne 0 ]; then
echo -e \
"\n\n\n" \
"-------------------------------------------------" \
"\n" \
"| Please run as root. |" \
"\n" \
"-------------------------------------------------" \
"\n\n\n";
exit
fi
# Ask username
read -p "Write username: " -r USERNAME
clear
greeting() {
printf "${PURPLE}%s\n" ""
<<<<<<< HEAD
printf "\n" " "
=======
printf "%s\n" " "
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
printf "%s\n" "-----------------------------------------------------------------------"
printf "%s\n" "| |"
printf "%s\n" "| ██████╗ ██╗ ██████╗███████╗ |"
printf "%s\n" "| ██╔══██╗██║██╔════╝██╔════╝ |"
printf "%s\n" "| ██████╔╝██║██║ █████╗ |"
printf "%s\n" "| ██╔══██╗██║██║ ██╔══╝ |"
printf "%s\n" "| ██║ ██║██║╚██████╗███████╗ |"
<<<<<<< HEAD
printf "%s,%s\n" "| ╚═╝ ╚═╝╚═╝ ╚═════╝╚══════╝ ${VERSION} |"
printf "%s\n" "| |"
printf "%s\n" "-----------------------------------------------------------------------"
printf "\n" " "
=======
printf "%s\n" "| ╚═╝ ╚═╝╚═╝ ╚═════╝╚══════╝ ${VERSION} |"
printf "%s\n" "| |"
printf "%s\n" "-----------------------------------------------------------------------"
printf "%s\n" " "
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
printf "${RESET}\n%s" ""
}
if ! command -v tput &> /dev/null ; then
:
else
RESET=$(tput sgr0)
PURPLE=$(tput setaf 127)
greeting
fi
deps_check() {
<<<<<<< HEAD
if pacman -Qi ${1} >/dev/null 2>&1 ; then
echo "\n${1} found!"
else
echo "\n${1} not found, installing"
pacman -S ${1} --noconfirm 1>/dev/null 2>>/home/$USERNAME/errors.log
=======
if pacman -Qi "${1}" >/dev/null 2>&1 ; then
echo -e "\n${1} found!"
else
echo -e "\n${1} not found, installing"
pacman -S "${1}" --noconfirm 1>/dev/null 2>>/home/"$USERNAME"/errors.log
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
echo "Finished."
fi
}
install() {
echo -e "\nInstalling ${1}:"
<<<<<<< HEAD
pacman -S ${1} --noconfirm 1>/dev/null 2>>/home/$USERNAME/errors.log
=======
pacman -S "${1}" --noconfirm 1>/dev/null 2>>/home/"$USERNAME"/errors.log
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
echo -e "Done."
}
aur_install() {
echo -e "\nInstalling ${1}:"
<<<<<<< HEAD
sudo -u $USERNAME git clone https://aur.archlinux.org/${1}.git 1>/dev/null 2>>/home/$USERNAME/errors.log
cd ${1}
sudo -u $USERNAME makepkg -sirc --noconfirm --noprogressbar 1>/dev/null 2>>/home/$USERNAME/errors.log
cd ..
rm -rf ${1}
=======
sudo -u "$USERNAME" git clone https://aur.archlinux.org/"${1}".git 1>/dev/null 2>>/home/"$USERNAME"/errors.log
cd "${1}" || exit
sudo -u "$USERNAME" makepkg -sirc --noconfirm --noprogressbar 1>/dev/null 2>>/home/"$USERNAME"/errors.log
rm -rf "${1}"
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
echo -e "Done."
}
dribbblish_install() {
if ! pacman -Qi spicetify-themes-git >/dev/null 2>&1 ; then
exit
fi
# Workaround to get Dribbblish folder only
<<<<<<< HEAD
cd /tmp && mkdir foo && cd foo
sudo -u $USERNAME git clone https://github.com/morpheusthewhite/spicetify-themes.git
cd spicetify-themes
sudo -u $USERNAME cp -r Dribbblish/ "$(dirname "$(spicetify -c)")/Themes/"
cd "$(dirname "$(spicetify -c)")/Themes/Dribbblish"
sudo -u $USERNAME cp dribbblish.js ../../Extensions
=======
cd /tmp && mkdir foo && cd foo || exit
sudo -u "$USERNAME" git clone https://github.com/morpheusthewhite/spicetify-themes.git
cd spicetify-themes || exit
sudo -u "$USERNAME" cp -r Dribbblish/ "$(dirname "$(spicetify -c)")/Themes/"
cd "$(dirname "$(spicetify -c)")/Themes/Dribbblish" || exit
sudo -u "$USERNAME" cp dribbblish.js ../../Extensions
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
spicetify config extensions dribbblish.js
spicetify config current_theme Dribbblish color_scheme base
spicetify config inject_css 1 replace_colors 1 overwrite_assets
spicetify backup apply
rm -rf /tmp/foo
<<<<<<< HEAD
} 1>/dev/null 2>>/home/$USERNAME/errors.log
=======
} 1>/dev/null 2>>/home/"$USERNAME"/errors.log
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
deps=(
"base-devel"
"git"
"curl"
"wget"
)
pkgs=(
"bspwm"
"sxhkd"
"rofi"
"rxvt-unicode"
"zsh"
"vim"
"slim"
"feh"
"python"
"python-gobject"
"python-pillow"
"python-pywal"
"xsettingsd"
"gtk-engine-murrine"
"dunst"
"ranger"
"youtube-dl"
)
aur_pkgs=(
"polybar"
"rofi"
"spotify"
"spicetify-cli"
"nerd-fonts-complete"
"wpgtk-git"
"spicetify-themes-git"
)
# Checking dependencies
echo -e "\nChecking depedencies..."
for ((k = 0 ; k < "${#deps[@]}" ; k++))
do
deps_check "${deps[${k}]}"
done
# Installing packages
for ((i = 0 ; i < "${#pkgs[@]}" ; i++))
do
#echo -e "\nPackage number ${i}"
install "${pkgs[${i}]}"
done
# Import spotify GPG key
<<<<<<< HEAD
sudo -u $USERNAME curl -sS https://download.spotify.com/debian/pubkey.gpg | gpg --import - 1>/dev/null 2>>/home/$USERNAME/errors.log
=======
sudo -u "$USERNAME" curl -sS https://download.spotify.com/debian/pubkey.gpg | gpg --import - 1>/dev/null 2>>/home/"$USERNAME"/errors.log
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
# Installing AUR packages:
dir=/home/$USERNAME/tempbuild
if [[ ! -e $dir ]]; then
<<<<<<< HEAD
sudo -u $USERNAME mkdir $dir
fi
cd $dir
=======
sudo -u "$USERNAME" mkdir "$dir"
fi
cd "$dir" || exit
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
for ((j = 0 ; j < "${#aur_pkgs[@]}" ; j++))
do
aur_install "${aur_pkgs[${j}]}"
if [ "${aur_pkgs[$j]}" == "spotify" ]; then
chmod a+wr /opt/spotify
chmod a+wr /opt/spotify/Apps -R
fi
done
cd ..
<<<<<<< HEAD
rm -rf $dir
=======
rm -rf "$dir"
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
echo -e "\nInstalling oh-my-zsh!"
<<<<<<< HEAD
sudo -u $USERNAME curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh 1>/dev/null 2>>/home/$USERNAME/errors.log
=======
sudo -u "$USERNAME" curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh 1>/dev/null 2>>/home/"$USERNAME"/errors.log
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
echo "Done."
echo -e "\nInstalling spicetify Dribbblish theme"
dribbblish_install
echo "Done."
echo -e "\nInstalling powerlevel10k theme..."
<<<<<<< HEAD
sudo -u $USERNAME git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/$USERNAME/powerlevel10k 1>/dev/null 2>>/home/$USERNAME/errors.log
echo "source /home/$USERNAME/powerlevel10k/powerlevel10k.zsh-theme" >>! /home/$USERNAME/.zshrc
echo -e "\nInstalling theme fonts..."
wget -P /home/$USERNAME/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf 1>/dev/null 2>>/home/$USERNAME/errors.log
wget -P /home/$USERNAME/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf 1>/dev/null 2>>/home/$USERNAME/errors.log
wget -P /home/$USERNAME/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf 1>/dev/null 2>>/home/$USERNAME/errors.log
wget -P /home/$USERNAME/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf 1>/dev/null 2>>/home/$USERNAME/errors.log
echo "Done."
echo -e "\nSetting slim as login manager..."
systemctl enable slim.service 1>/dev/null 2>>/home/$USERNAME/errors.log
systemctl start slim.service 1>/dev/null 2>>/home/$USERNAME/errors.log
=======
sudo -u "$USERNAME" git clone --depth=1 https://github.com/romkatv/powerlevel10k.git /home/"$USERNAME"/powerlevel10k 1>/dev/null 2>>/home/"$USERNAME"/errors.log
echo "source /home/$USERNAME/powerlevel10k/powerlevel10k.zsh-theme" >>! /home/"$USERNAME"/.zshrc
echo -e "\nInstalling theme fonts..."
{
wget -P /home/"$USERNAME"/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf
wget -P /home/"$USERNAME"/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf
wget -P /home/"$USERNAME"/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf
wget -P /home/"$USERNAME"/.local/share/fonts -q https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf
} 1>/dev/null 2>>/home/"$USERNAME"/errors.log
echo "Done."
echo -e "\nSetting slim as login manager..."
systemctl enable slim.service 1>/dev/null 2>>/home/"$USERNAME"/errors.log
systemctl start slim.service 1>/dev/null 2>>/home/"$USERNAME"/errors.log
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
echo "Done."
# Getting hands dirty
echo -e "\nGetting elektropunk dotfiles..."
<<<<<<< HEAD
sudo -u $USERNAME git clone https://github.com/VaughnValle/elektropunk.git 1>/dev/null 2>>/home/$USERNAME/errors.log
cd elektropunk
sudo -u $USERNAME cp -r ./* /home/$USERNAME/.config/
=======
sudo -u "$USERNAME" git clone https://github.com/VaughnValle/elektropunk.git 1>/dev/null 2>>/home/"$USERNAME"/errors.log
cd elektropunk || exit
sudo -u "$USERNAME" cp -r ./* /home/"$USERNAME"/.config/
>>>>>>> bbcc7771341c2968d532085dc2d3d9b9e62be5c1
#sudo -u $USERNAME mv /home/$USERNAME/.config/.Xresources /home/$USERNAME/
#sudo -u $USERNAME mv /home/$USERNAME/.config/.vimrc /home/$USERNAME/
cd ..
rm -rf elektropunk
echo "Done."
# Finished?
exit