-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·304 lines (255 loc) · 8.62 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
#!/usr/bin/env bash
set -e
if [[ ! -f "/etc/arch-release" ]]; then
echo "This script is intended for Arch Linux only!"
exit 1
fi
if [[ -f "/run/archiso/cowspace" ]]; then
echo "This script is not intended to be run in a live environment!"
exit 1
fi
if [[ $EUID -eq 0 ]]; then
echo "This script shall not be run as root!"
exit 1
fi
SHELLS_DEPS=(
"stow"
"zsh" # best shell ever
"bash" # just in case you somehow dont have bash
"git" # i guess you wouldnt get this far without git but just in case
)
NEOVIM_DEPS=(
"stow"
"neovim" # duh
"python" # honestly i dont remember why but its probably important if its here
"fzf" # fzf is a godsend
"ripgrep" # same for you rg <3
"nodejs" "npm" # i think this is needed for a lot of lsp stuff
"curl" # for downloading stuff
)
GHOSTTY_DEPS=(
"stow"
"ghostty" # duh
)
FONTS_DEPS=(
"wget" # for downloading stuff (again)
"unzip" # why is .zip still a thinggg
"fontconfig" # duh
".AUR:ttf-ms-win11-auto" # microsoft fonts, needed for many websites
".AUR:ttf-twemoji" # our emoji font of choice
)
HYPRLAND_DEPS=(
"stow"
"hyprland" # duh
"xdg-desktop-portal-hyprland" # portals for hyprland
"xdg-desktop-portal-gtk" # for gtk darkmode
"polkit-gnome" # gtk gui for polkit
"qt5-wayland" "qt6-wayland" # qt wayland support
"pipewire" # audio server
"pipewire-pulse" "pipewire-jack" "pipewire-alsa" # pipewire modules
"gst-plugin-pipewire" # gstreamer pipewire plugin
"alsa-utils" # alsa utilities
"hyprpaper" # wallpaper manager
"hyprpicker" # colour picker
"hypridle" # idle manager (sleep after inactivity etc.)
"rofi-wayland" # app launcher
".AUR:hyprshot" "grim" "slurp" # screenshots
"imagemagick" "tesseract" "tesseract-data-eng" # needed for area ocr
"waybar" # status bar
".PARU" # explicitly install aur manager
".AUR:clipse-bin" "wl-clipboard" # clipboard
"swaync" # notifications
"pamixer" "pavucontrol" # audio control
"nwg-displays" # gui monitor configuration
"adw-gtk-theme" # gtk3 theme
"pacman-contrib" # for update module in waybar
# my apps
"nautilus" # file manager
"firefox" # web browser
)
GAMING_DEPS=(
"steam" # duh
".AUR:proton-ge-custom-bin" # latest proton-ge
"gamemode" # cpu governor optimisation, to squeeze out a couple more framses
"gamescope" # game compositor
"mangohud" # performance monitoring hud
)
install_paru() {
git clone https://aur.archlinux.org/paru-bin.git /tmp/paru-bin
cd /tmp/paru-bin
makepkg -si
cd - > /dev/null
rm -rf paru-bin
}
install_packages() {
local aur_packages=()
local pacman_packages=()
local install_paru=false
for package in "$@"; do
if [[ $package == ".AUR:"* ]]; then
aur_packages+=("${package:5}")
install_paru=true
elif [[ $package == ".PARU" ]]; then
install_paru=true
else
pacman_packages+=("$package")
fi
done
if command -v paru &> /dev/null; then
install_paru=false
fi
if $install_paru; then
install_paru
fi
if [[ ${#aur_packages[@]} -gt 0 ]]; then
paru -S --noconfirm "${aur_packages[@]}"
fi
if [[ ${#pacman_packages[@]} -gt 0 ]]; then
sudo pacman -S --noconfirm "${pacman_packages[@]}"
fi
}
fonts_installed=false
install_fonts() {
if $fonts_installed; then
return
fi
fonts_installed=true
local twemojilinkcmd="sudo ln -sf /usr/share/fontconfig/conf.avail/75-twemoji.conf /etc/fonts/conf.d/75-twemoji.conf"
install_packages "${FONTS_DEPS[@]}"
echo "Running: $twemojilinkcmd"
echo "This will require root permissions!"
eval $twemojilinkcmd
mkdir -p "$HOME/.local/share/fonts"
wget -O "/tmp/CascadiaCode.zip" "https://github.com/microsoft/cascadia-code/releases/download/v2404.23/CascadiaCode-2404.23.zip" && \
unzip -o "/tmp/CascadiaCode.zip" -d "/tmp/CascadiaCode"
mv "/tmp/CascadiaCode/ttf"/* "$HOME/.local/share/fonts"
fc-cache -f
}
shells_installed=false
install_shells() {
if $shells_installed; then
return
fi
shells_installed=true
install_packages "${SHELLS_DEPS[@]}"
if [[ -f "$HOME/.bashrc" ]]; then
mv "$HOME/.bashrc" "$HOME/.bashrc.bak"
echo "Moved existing .bashrc to .bashrc.bak"
fi
if [[ -f "$HOME/.zshrc" ]]; then
mv "$HOME/.zshrc" "$HOME/.zshrc.bak"
echo "Moved existing .zshrc to .zshrc.bak"
fi
stow -t "$HOME" shells
}
neovim_installed=false
install_neovim() {
if $neovim_installed; then
return
fi
neovim_installed=true
install_packages "${NEOVIM_DEPS[@]}"
install_fonts
stow -t "$HOME" nvim
}
ghostty_installed=false
install_ghostty() {
if $ghostty_installed; then
return
fi
ghostty_installed=true
install_packages "${GHOSTTY_DEPS[@]}" && \
install_fonts && \
stow -t "$HOME" ghostty
}
hyprland_installed=false
install_hyprland() {
if $hyprland_installed; then
return
fi
hyprland_installed=true
install_gpu_drivers # hyprland relies on gpu acceleration
install_packages "${HYPRLAND_DEPS[@]}"
install_fonts
install_ghostty
stow -t "$HOME" hypr waybar rofi wallpapers gtk3
echo "Make sure you run nwg-displays to configure your displays graphically"
}
multilib_enabled=false
enable_multilib() {
if $multilib_enabled; then
return
fi
multilib_enabled=true
if ! grep -q "^\[multilib\]" /etc/pacman.conf; then
echo "Enabling multilib repository"
echo "[multilib]" | sudo tee -a /etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf
sudo pacman -Sy --noconfirm
fi
}
gpu_dr_installed=false
install_gpu_drivers() {
if $gpu_dr_installed; then
return
fi
gpu_dr_installed=true
install_packages "mesa" "libva-mesa-driver" "mesa-vdpau"
for gpu in /sys/class/drm/card[0-9]/device; do
if [[ -d $gpu ]]; then
vendor_id="$(cat $gpu/vendor)"
if [[ $vendor_id == "0x1002" ]]; then
echo "AMD GPU detected"
install_packages "vulkan-radeon"
elif [[ $vendor_id == "0x8086" ]]; then
echo "Intel GPU detected"
install_packages "vulkan-intel" "intel-media-driver"
elif [[ $vendor_id == "0x10de" ]]; then
install_packages "nvidia-dkms" "nvidia-utils"
else
echo "Unknown GPU vendor for GPU $gpu, install drivers in this shell and exit to continue the process"
bash
fi
fi
done
}
install_gaming() {
enable_multilib
install_gpu_drivers
install_packages "${GAMING_DEPS[@]}"
}
main() {
first_dir="$(pwd)"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
cd "$script_dir"
if [[ $# -eq 0 ]]; then
echo "Usage: $0 <package>"
echo "Available packages: shells, neovim, ghostty, hyprland, fonts, gaming"
echo "Or run $0 all to install all packages"
exit 1
fi
if [[ $1 == "shells" ]]; then
install_shells
elif [[ $1 == "neovim" ]]; then
install_neovim
elif [[ $1 == "ghostty" ]]; then
install_ghostty
elif [[ $1 == "hyprland" ]]; then
install_hyprland
elif [[ $1 == "fonts" ]]; then
install_fonts
elif [[ $1 == "gaming" ]]; then
install_gaming
elif [[ $1 == "all" ]]; then
install_gaming
install_shells
install_neovim
install_hyprland
else
echo "Unknown package: $1"
cd "$first_dir"
exit 1
fi
cd "$first_dir"
}
main "$@"