-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
388 lines (330 loc) · 12.4 KB
/
install.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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#!/bin/bash
create_folders() {
mkdir -p $HOME/.cache/wal
mkdir -p $HOME/.config
mkdir -p $HOME/.local/bin
mkdir -p $HOME/.local/share/applications
mkdir -p $HOME/Documents/Github/Gists
mkdir -p $HOME/Documents/Github/Repos
mkdir -p $HOME/Documents/LNs
mkdir -p $HOME/Documents/Notes
mkdir -p $HOME/Documents/Papers
mkdir -p $HOME/Documents/ROM
mkdir -p $HOME/Downloads
mkdir -p $HOME/Music
mkdir -p $HOME/Pictures/gallery-dl
mkdir -p $HOME/Pictures/mpv
mkdir -p $HOME/Pictures/Screenshots
mkdir -p $HOME/Pictures/Wallpapers
mkdir -p $HOME/Videos/Recordings
mkdir -p $HOME/Videos/Seasonals
mkdir -p $HOME/Videos/Temp
sudo mkdir -p /etc/modprobe.d
sudo mkdir -p /usr/share/xsessions
}
no_password_sudoers() {
# This is unnecessary if you can already use sudo without using password and should be commented out
sudo sed -i "/^root\sALL=(ALL:ALL)\sALL/a $USER ALL=(ALL) NOPASSWD: ALL" /etc/sudoers
echo "==================================================="
echo "Enabled $USER to use sudo without having to enter password."
}
enable_pacman_color() {
sudo sed -i 's/^#Color/Color/' /etc/pacman.conf
echo "==================================================="
echo "Enabled colors on pacman and AUR helpers like paru and yay."
}
install_pacman_packages() {
echo "==================================================="
echo "Installing pacman packages."
echo "==================================================="
# Note: pacman -Qeq gives explicitly installed pacman packages
while IFS= read -r package || [ -n "$package" ]; do
if ! pacman -Qq "$package" &>/dev/null; then
((attempted_packages++))
if sudo pacman -S --noconfirm --needed "$package"; then
((installed_packages++))
else
no_install_pacman_packages+=("$package")
fi
fi
done <"install/pacman.txt"
echo "==================================================="
echo "Finished installing pacman packages."
echo "$installed_packages/$attempted_packages installed."
}
install_aur_packages() {
echo "==================================================="
echo "Installing AUR packages."
echo "==================================================="
# Note: pacman -Qmq gives explicitly installed AUR packages
while IFS= read -r package || [ -n "$package" ]; do
if ! pacman -Qm "$package" &>/dev/null; then
((attempted_packages++))
if paru -S --noconfirm --needed "$package"; then
((installed_packages++))
else
no_install_aur_packages+=("$package")
fi
fi
done <"install/aur.txt"
echo "==================================================="
echo "Finished installing AUR packages."
echo "$installed_packages/$attempted_packages installed."
}
install_aur_packages_2_electric_boogaloo() {
echo "==================================================="
echo "Install packages that couldn't be installed using pacman."
echo "==================================================="
if [ ${#no_install_pacman_packages[@]} -gt 0 ]; then
for package in "${no_install_pacman_packages[@]}"; do
if ! pacman -Qq "$package" &>/dev/null; then
((attempted_packages++))
if paru -S --noconfirm --needed "$package"; then
((installed_packages++))
else
no_install_aur_packages+=("$package")
fi
fi
done
fi
echo "==================================================="
echo "Finished trying to install packages that couldn't be installed using pacman."
echo "$installed_packages/$attempted_packages installed."
}
install_pip_packages() {
echo "==================================================="
echo "Installing pip packages."
echo "==================================================="
# Note: pip freeze | cut -d'=' -f1 gives installed pip packages
pip install --no-warn-script-location -r install/pip.txt
# optional
# pip install "$(pwd)/.local/bin/pyupload/"
# pip install "$(pwd)/.local/bin/pywal-kde/"
echo "==================================================="
echo "Finished installing pip packages."
echo "$installed_packages/$attempted_packages installed."
}
clear_pacman_cache() {
echo "==================================================="
echo "Clearing pacman cache."
echo "==================================================="
sudo pacman -Sc --noconfirm
echo "==================================================="
echo "Cleared pacman cache."
}
clear_aur_cache() {
echo "==================================================="
echo "Clearing AUR cache."
echo "==================================================="
paru -Sc --noconfirm
echo "==================================================="
echo "Cleared AUR cache."
}
removing_unnecessary_dependencies() {
echo "==================================================="
echo "Removing unnecessary dependencies."
echo "==================================================="
sudo pacman -Rncs $(pacman -Qdtq) --noconfirm
paru -Rncs $(paru -Qdtq) --noconfirm
echo "==================================================="
echo "Removed unnecessary dependencies."
}
install_paru() {
echo "==================================================="
echo "Installing paru."
echo "==================================================="
if ! pacman -Qq paru &>/dev/null; then
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si --noconfirm --needed
cd ..
rm -rf paru
echo "==================================================="
echo "Installed paru."
else
echo "paru is already installed."
fi
}
install_blesh() {
echo "==================================================="
echo "Installing ble.sh."
echo "==================================================="
git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.git
make -C "$(pwd)/ble.sh" install PREFIX="$HOME/.local"
rm -rf "$(pwd)/ble.sh"
echo "==================================================="
echo "Installed ble.sh."
}
create_symlinks() {
echo "==================================================="
echo "Creating symlinks."
# / #
sudo cp -f $(pwd)/misc/environment /etc/environment
sudo cp -f $(pwd)/misc/fstab1 /etc/fstab1
sudo cp -f $(pwd)/misc/profile /etc/profile
sudo cp -f $(pwd)/misc/blacklist.conf /etc/modprobe.d/blacklist.conf
sudo cp -f $(pwd)/misc/polkit-start.service /etc/systemd/system/polkit-start.service
sudo cp -f $(pwd)/misc/dwmstart /usr/local/bin/dwmstart
sudo cp -f $(pwd)/misc/51-necraul.rules /usr/share/polkit1/rules.d/51-necraul.rules
sudo cp -f $(pwd)/misc/Xsetup /usr/share/sddm/scripts/Xsetup
sudo cp -f $(pwd)/misc/Background.png /usr/share/sddm/themes/where_is_my_sddm_theme/Background.png
sudo cp -f $(pwd)/misc/theme.conf /usr/share/sddm/themes/where_is_my_sddm_theme/theme.conf
sudo cp -f $(pwd)/misc/dwm.desktop /usr/share/xsessions/dwm.desktop
# # #
# ~ #
cp -f $(pwd)/misc/.bashrc $HOME/.bashrc
cp -f $(pwd)/misc/.prettierrc $HOME/.prettierrc
cp -f $(pwd)/misc/.pypirc $HOME/.pypirc
# # #
# config #
for item in \
".config/blesh" \
".config/cava" \
".config/czkawka" \
".config/dunst" \
".config/gallery-dl" \
".config/git" \
".config/gtk-2.0" \
".config/gtk-3.0" \
".config/gtk-4.0" \
".config/lf" \
".config/mpd" \
".config/mpv" \
".config/ncmpcpp" \
".config/neofetch"
".config/npm" \
".config/nsxiv" \
".config/nvim" \
".config/picom" \
".config/pip" \
".config/pyNPS" \
".config/python" \
".config/qt6ct" \
".config/shell" \
".config/tmux" \
".config/wal" \
".config/weechat" \
".config/wget" \
".config/wireplumber" \
".config/x11" \
".config/zathura" \
".config/zoxide" \
".config/mimeapps.list"; do
ln -sf "$(pwd)/$item" "$HOME/$item"
done
# # # # # #
# bin #
for dir in \
"$HOME/.local/bin/4chan-pywal" \
"$HOME/.local/bin/kuroneko-themes" \
"$HOME/.local/bin/pywal-kde" \
"$HOME/.local/bin/pywal-kde-plasma" \
"$HOME/.local/bin/scripts" \
"$HOME/.local/bin/statusbar" \
"$HOME/.local/bin/zathura-pywal"; do
mkdir -p "$dir"
ln -sf "$(pwd)/${dir#$HOME/}/"* "$dir"
done
mkdir -p "$HOME/.local/bin/pyupload-devel"
ln -sf "$(pwd)/.local/bin/pyupload/"* "$HOME/.local/bin/pyupload-devel"
# # # # # #
# share #
for file in $(pwd)/.local/share/applications/*; do
filename=$(basename "$file")
ln -sf "$file" $HOME/.local/share/applications/"$filename"
done
ln -sf $(pwd)/.local/share/kio $HOME/.local/share/kio
ln -sf $(pwd)/.local/share/bg $HOME/.local/share/bg
# # # # #
# cache #
ln -sf $(pwd)/.cache/wal/dunstrc $HOME/.cache/wal/dunstrc
ln -sf $(pwd)/.cache/wal/zathurarc $HOME/.cache/wal/zathurarc
# # # # #
echo "==================================================="
echo "Created symlinks."
}
install_zathura_pywal() {
echo "==================================================="
echo "Installing zathura-pywal."
sudo make install -C $HOME/.local/bin/zathura-pywal
zathura-pywal -a 0.8
echo "==================================================="
echo "Installed zathura-pywal."
}
install_grub_theme() {
echo "==================================================="
echo "Installing GRUB theme."
sudo bash $(pwd)/.local/bin/kuroneko-themes/install.sh
echo "==================================================="
echo "Installed GRUB theme."
}
enable_services() {
echo "==================================================="
echo "Enabling systemd services."
sudo systemctl enable sddm.service
sudo systemctl enable polkit-start.service
echo "==================================================="
echo "Enabled systemd services."
}
no_install_arrays() {
# Array to hold pacman, AUR and pip packages that couldn't be installed
declare -a no_install_pacman_packages=()
declare -a no_install_aur_packages=()
declare -a no_install_pip_packages=()
}
reset_package_count() {
declare -i installed_packages=0
declare -i attempted_packages=0
}
pypi_token() {
echo "==================================================="
echo "Paste your PyPI token and press Enter to finish:"
echo "==================================================="
read pypi
sed -i "s/placeholder/$pypi/g" "$HOME/.pypirc"
}
github_credentials() {
echo "==================================================="
echo "Paste your Github username and press Enter to finish:"
echo "==================================================="
read gu
echo "==================================================="
echo "Paste your Github public access token and press Enter to finish: "
echo "==================================================="
read gpat
sed -i "s/gu/$gu/g" "$HOME/.bashrc"
sed -i "s/gpat/$gpat/g" "$HOME/.bashrc"
}
no_install_packages_to_txt() {
mkdir -p no_install
printf "%s\n" "${no_install_pacman_packages[@]}" >no_install/pacman.txt
printf "%s\n" "${no_install_aur_packages[@]}" >no_install/aur.txt
printf "%s\n" "${no_install_pip_packages[@]}" >no_install/pip.txt
echo "==================================================="
echo "Script has finished running. Packages that couldn't be installed were written into text files in the no_install folder."
echo "==================================================="
}
create_folders
no_password_sudoers
enable_pacman_color
no_install_arrays
reset_package_count
install_pacman_packages
clear_pacman_cache
install_paru
reset_package_count
install_aur_packages
reset_package_count
install_aur_packages_2_electric_boogaloo
clear_aur_cache
removing_unnecessary_dependencies
create_symlinks
install_zathura_pywal
reset_package_count
install_pip_packages
install_blesh
install_grub_theme
enable_services
pypi_token
github_credentials
no_install_packages_to_txt