-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
373 lines (325 loc) · 15.2 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
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
#!/bin/bash
user="$(logname)"
home=$(sudo -u "$user" sh -c 'echo $HOME')
dir="$(dirname "$(readlink -f "$0")")"
#Run command as non root user
as_user() {
runuser -u $user -- $1
}
check_condition() {
while [ true ]; do
read -r input
if [ $input = "y" ] || [ $input = "Y" ]; then
($1)
break
elif [ $input = "n" ] || [ $input = "N" ]; then
($2)
break
fi
done
}
check_for_updates() {
echo "================================Check for updates===============================\n"
sleep 1
xbps-install -Syu
echo "\n==============================System files updated!=============================\n"
sleep 2
}
clean_up() {
echo "===================================Cleaning up==================================\n"
sleep 1
rm $home/Downloads/BitsNPicas.jar
rm $home/Downloads/jdk17.tar.gz
rm $home/Downloads/SourceCodePro.tar.xz
rm -r -f $home/Downloads/compfy
rm -r -f $home/Downloads/Graphite-gtk-theme
rm -r -f $home/Downloads/lite-xl-plugins
rm -r -f $home/Downloads/lite-xl-colors
rm -r -f $home/Downloads/lite-xl-terminal
rm -r -f $home/Downloads/scientifica
xbps-remove -R sassc
echo "==============================Сleanup is complete!==============================\n"
sleep 2
}
configure_path_var() {
echo "===========================PATH variable configuration==========================\n"
sleep 1
export PATH=$PATH:$home/.local/bin:$home/.jdks/default/bin
echo "====================PATH variable configuration is complete!====================\n"
sleep 2
}
configure_services() {
echo "==============================Configuring services==============================\n"
sleep 1
#Autostart settings
ln -s /etc/sv/chronyd /var/service/
ln -s /etc/sv/containerd /var/service/
ln -s /etc/sv/dbus /var/service/
ln -s /etc/sv/docker /var/service/
ln -s /etc/sv/lightdm /var/service/
ln -s /etc/sv/NetworkManager /var/service/
ln -s /etc/sv/polkitd /var/service/
#Remove conflicting services
cd /var/service
rm -rf acpid
rm -rf wpa_supplicant
rm -rf dhcpcd*
echo "=======================Service configuration is complete!=======================\n"
sleep 2
}
copy_user_files() {
echo "===============================Copying user files===============================\n"
sleep 1
echo " What to do with the users files :\n
1) Copy files
2) Symlink files
3) Show user files
4) Do nothing
"
while [ true ]; do
read -r input
case $input in
1 )
as_user "cp -r $dir/home/. $home"
break
;;
2 )
#There's no point in symlinking the .icons/
as_user "cp -r $dir/home/.icons $home"
as_user "ln -sf $dir/home/.bashrc $home"
as_user "ln -sf $dir/home/.xinitrc $home"
as_user "ln -sf $dir/home/.xscreensaver $home"
as_user "ln -sf $dir/home/.zshrc $home"
as_user "ln -sf $dir/home/.oh-my-zsh/themes/* $home/.oh-my-zsh/themes"
dirs=$(ls -Ap $dir/home/.config)
for d in ${dirs}; do
if [ -d $home/.config/$d ]; then
as_user "ln -sf $dir/home/.config/$d* $home/.config/$d"
else
as_user "ln -sf $dir/home/.config/$d $home/.config"
fi
done
break
;;
3 )
echo $(ls -Ap $dir/home/)
;;
4 )
break
;;
* )
echo " Enter valid number"
;;
esac
done
cp -r $dir/dm/. /etc/lightdm
echo "\n=======================Сopying of user files is complete!=======================\n"
sleep 2
}
create_user_dir() {
echo "============================Creating user directories===========================\n"
sleep 1
cd $home
as_user "mkdir Downloads"
as_user "mkdir Screenshots"
as_user "mkdir Screenrecs"
as_user "mkdir .ssh"
as_user "mkdir .jdks"
echo "======================User directory creation is complete!======================\n"
sleep 2
}
init() {
echo "
██╗ ██╗ ██████╗ ██╗██████╗ ██╗ ██╗███╗ ██╗██╗ ██╗██╗ ██╗
██║ ██║██╔═══██╗██║██╔══██╗ ██║ ██║████╗ ██║██║ ██║╚██╗██╔╝
██║ ██║██║ ██║██║██║ ██║ ██║ ██║██╔██╗ ██║██║ ██║ ╚███╔╝
╚██╗ ██╔╝██║ ██║██║██║ ██║ ██║ ██║██║╚██╗██║██║ ██║ ██╔██╗
╚████╔╝ ╚██████╔╝██║██████╔╝ ███████╗██║██║ ╚████║╚██████╔╝██╔╝ ██╗
╚═══╝ ╚═════╝ ╚═╝╚═════╝ ╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝
██████╗ ██████╗ ████████╗███████╗
██╔══██╗██╔═══██╗╚══██╔══╝██╔════╝
██║ ██║██║ ██║ ██║ ███████╗
██║ ██║██║ ██║ ██║ ╚════██║
██████╔╝╚██████╔╝ ██║ ███████║
╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
██╗███╗ ██╗███████╗████████╗ █████╗ ██╗ ██╗ ███████╗██████╗
██║████╗ ██║██╔════╝╚══██╔══╝██╔══██╗██║ ██║ ██╔════╝██╔══██╗
██║██╔██╗ ██║███████╗ ██║ ███████║██║ ██║ █████╗ ██████╔╝
██║██║╚██╗██║╚════██║ ██║ ██╔══██║██║ ██║ ██╔══╝ ██╔══██╗
██║██║ ╚████║███████║ ██║ ██║ ██║███████╗███████╗███████╗██║ ██║
╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝╚═╝ ╚═╝
"
sleep 1
echo " Do you want to continue? [y/N]:"
check_condition start_installation quit_installation
}
install_external_packages() {
echo "==========================Installing external packages==========================\n"
sleep 1
#Install ohmyzsh
as_user "curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh" | as_user bash --unattended
##Change shell to zsh
chsh -s /bin/zsh $user
#Install ranger devicons
as_user "git clone https://github.com/alexanderjeurissen/ranger_devicons $home/.config/ranger/plugins/ranger_devicons"
#Install meson and ninja
as_user "pipx install meson"
as_user "pipx install ninja"
#Install compfy
as_user "git clone https://github.com/allusive-dev/compfy.git $home/Downloads/compfy"
cd $home/Downloads/compfy \
&& meson setup . build \
&& ninja -C build \
&& ninja -C build install
#Install JDK
as_user "curl -L \
"$(curl -fsSL https://api.github.com/repos/adoptium/temurin17-binaries/releases/latest \
| grep -Eo "https.*OpenJDK17U-jdk.*x64_linux.*\.tar\.gz" \
| head -n1)" \
--output $home/Downloads/jdk17.tar.gz"
as_user "tar xfv $home/Downloads/jdk17.tar.gz -C $home/.jdks"
as_user "ln -s $home/.jdks/jdk* $home/.jdks/default"
#Install JetBrainsMono font
as_user "curl -fsSL https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/install_manual.sh" | as_user bash
#Install scientifica font
as_user "git clone https://github.com/Computer-M/scientifica.git $home/Downloads/scientifica"
as_user "curl -L \
"$(curl -fsSL \https://api.github.com/repos/kreativekorp/bitsnpicas/releases/latest \
| grep -Eo "https.*BitsNPicas.jar" \
| head -n1)" \
--output $home/Downloads/BitsNPicas.jar"
as_user "java -jar $home/Downloads/BitsNPicas.jar \
convertbitmap -f ttf -o $home/.local/share/fonts/scientifica.ttf \
$home/Downloads/scientifica/src/scientifica.sfd"
#Install SourceCodePro (Nerd patched) font
as_user "curl -L \
https://github.com/ryanoasis/nerd-fonts/releases/latest/download/SourceCodePro.tar.xz \
--output $home/Downloads/SourceCodePro.tar.xz"
as_user "tar xfv $home/Downloads/SourceCodePro.tar.xz -C $home/.local/share/fonts"
#Install Grpahite-gtk-theme
as_user "git clone https://github.com/vinceliuice/Graphite-gtk-theme.git $home/Downloads/Graphite-gtk-theme"
as_user "bash -c $home/Downloads/Graphite-gtk-theme/install.sh --tweaks rimless"
#Install lite-xl plugins and colors
as_user "git clone https://github.com/lite-xl/lite-xl-plugins.git $home/Downloads/lite-xl-plugins"
as_user "git clone https://github.com/lite-xl/lite-xl-colors.git $home/Downloads/lite-xl-colors"
as_user "git clone https://github.com/adamharrison/lite-xl-terminal.git $home/Downloads/lite-xl-terminal"
as_user "mkdir -p $home/.config/lite-xl"
##Install lite-xl terminal plugin
as_user "cp -R $home/Downloads/lite-xl-terminal/plugins $home/.config/lite-xl"
as_user "curl -L \
https://github.com/adamharrison/lite-xl-terminal/releases/download/latest/libterminal.x86_64-linux.so \
--output $home/.config/lite-xl/plugins/terminal/libterminal.x86_64-linux.so"
##Get the colors from alacritty.toml and set them in the lite-xl terminal.
while read line
do
case $line in
*black* )
replacement=$replacement" \[ 0\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 8\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*blue* )
replacement=$replacement" \[ 4\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 12\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*cyan* )
replacement=$replacement" \[ 6\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 14\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*green* )
replacement=$replacement" \[ 2\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 10\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*magenta* )
replacement=$replacement" \[ 5\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 13\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*red* )
replacement=$replacement" \[ 1\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 9\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*white* )
replacement=$replacement" \[ 7\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 15\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*yellow* )
replacement=$replacement" \[ 3\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
replacement=$replacement" \[ 11\] = { common.color $(echo $line | sed -E -e 's/.*(.*\"#.*).*/\1/g') },\n";
;;
*colors.normal* )
break
;;
esac
done < "$dir/home/.config/scripts/theme-switcher/themes/dark/alacritty.toml"
bgColor=$(cat $dir/home/.config/scripts/theme-switcher/themes/dark/alacritty.toml | grep background | cut -d ' ' -f 3)
fgColor=$(cat $dir/home/.config/scripts/theme-switcher/themes/dark/alacritty.toml | grep foreground | cut -d ' ' -f 3)
row=$row"s/.*background = { common.color \"#.*\".*/ background = { common.color $bgColor },/;"
row=$row"s/.*text = { common.color \"#.*\".*/ text = { common.color $fgColor },/;"
row=$row"s/.*\[ 5\] = { common.color \"#.*\" },.*\s//;"
row=$row"s/.*\[ 10\] = { common.color \"#.*\" },.*\s//;"
row=$row"s/.*\[ 15\] = { common.color \"#.*\" },.*\s//;"
row=$row"s/.*\[ 0\] = { common.color \"#.*\" },.*\s/$replacement/"
perl -pi -e "$row" $home/.config/lite-xl/plugins/terminal/init.lua
##Install the other plugins
cd $home/Downloads/lite-xl-plugins/plugins \
&& as_user "cp \
align_carets.lua \
autoinsert.lua \
autowrap.lua \
bracketmatch.lua \
colorpreview.lua \
extend_selection_line.lua \
fontconfig.lua \
ghmarkdown.lua \
indentguide.lua \
language_*.lua \
restoretabs.lua \
selectionhighlight.lua \
select_colorscheme.lua \
sort.lua \
sticky_scroll.lua \
su_save.lua \
$home/.config/lite-xl/plugins"
##Install the color schemes
as_user "cp -R $home/Downloads/lite-xl-colors/colors $home/.config/lite-xl"
echo "\n=================Installation of external packages is complete!=================\n"
sleep 2
}
install_repo_packages() {
echo "==================Installing packages from the main repository==================\n"
sleep 1
xbps-install -Sy \
alacritty alsa-plugins-pulseaudio bluez blueman bspwm breeze-obsidian-cursor-theme breeze-snow-cursor-theme \
btop chrony curl dbus dbus-devel dbus-libs dbus-x11 docker docker-compose dunst elogind exa feh ffmpeg firefox \
flameshot font-awesome6 gcc libconfig libconfig-devel libconfig++ libconfig++-devel libev libev-devel libevdev \
libglvnd libglvnd-devel libX11 libX11-devel libxcb libxcb-devel libxdg-basedir lightdm lightdm-mini-greeter \
lite-xl make micro mpv neofetch NetworkManager numlockx pavucontrol pcre2 pcre2-devel pixman pixman-devel polkit \
polybar pulseaudio python3-pipx python3-pkgconfig ranger rofi sassc slop sxhkd unzip uthash xcb-util-image \
xcb-util-image-devel xcb-util-renderutil xcb-util-renderutil-devel xdg-utils xdotool xcmenu xorg xscreensaver zip zsh
echo "\n===========Installation packages from the main repository is complete!==========\n"
sleep 2
}
quit_installation() {
echo "\n==============================Quit the installation============================="
exit
}
reboot_system() {
echo "\n====================================Rebooting==================================="
sleep 1
reboot
}
start_installation() {
echo "\n===============================Start installation===============================\n"
sleep 1
configure_path_var
check_for_updates
create_user_dir
install_repo_packages
install_external_packages
configure_services
copy_user_files
clean_up
echo "Installation completed, reboot now? [y/N]:"
check_condition reboot_system quit_installation
}
init
exit