-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
495 lines (344 loc) · 10.8 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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
#!/bin/bash
# This script configures the installed arch linux for daily use.
multilib() {
# enable multi-lib for 32-bit apps.
echo "" >>/etc/pacman.conf
echo "[multilib]" >>/etc/pacman.conf
echo "Include = /etc/pacman.d/mirrorlist" >>/etc/pacman.conf
# refresh database.
pacman -Syy reflector --noconfirm
reflector --country India --protocol https --save /etc/pacman.d/mirrorlist
}
timezone() {
# set timezone.
ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
# set the hardware clock from the system clock.
hwclock --systohc
# enable network time sync.
timedatectl set-ntp true
}
locale() {
# uncomment required locales from '/etc/locale.gen'.
sed -i 's/#en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
# generate locale.
locale-gen
# set system locale ~ creates 'locale.conf'.
localectl set-locale LANG=en_US.UTF-8
# install fonts.
pacman -S ttf-firacode-nerd nerd-fonts noto-fonts noto-fonts-extra noto-fonts-emoji font-manager --noconfirm
}
network() {
# create the hostname file.
echo "arch" >/etc/hostname
# install & enable network.
pacman -S networkmanager network-manager-applet --noconfirm
systemctl enable NetworkManager
# add entries for localhost to '/etc/hosts' file.
# ( if the system has a permanent IP address, it should be used instead of 127.0.1.1 )
# echo -e 127.0.0.1'\t'localhost'\n'::1'\t\t'localhost'\n'127.0.1.1'\t'arch >> /etc/hosts
# install & enable firewall.
pacman -S ufw --noconfirm
systemctl enable ufw
# allow outgoing & reject incoming.
ufw default allow outgoing
ufw default deny incoming
}
bluetooth() {
# install bluetooth.
pacman -S blueman bluez bluez-utils --noconfirm
lsmod | grep btusb
rfkill unblock bluetooth
systemctl enable bluetooth.service
}
audio() {
# install audio packages.
pacman -S pipewire lib32-pipewire wireplumber pipewire-audio pipewire-alsa pipewire-pulse sof-firmware pavucontrol alsa-utils --noconfirm
}
webcam() {
# install webcam packages.
pacman -S v4l-utils cameractrls --noconfirm
}
chipset() {
# install microcode for amd.
vendor="$(lscpu | grep 'Model name')"
if [[ "$vendor" == *"AMD"* ]]; then
echo "AMD CPU Found !"
pacman -S amd-ucode --noconfirm
fi
}
gpu() {
# DRI driver for 3D acceleration.
pacman -S mesa lib32-mesa --noconfirm
vendor="$(lspci -v | grep -iE 'vga|3d|2d')"
if [[ "$vendor" == *"AMD"* ]]; then
echo "AMD GPU Found !"
# DDX driver which provides 2D acceleration in Xorg
pacman -S xf86-video-amdgpu --noconfirm
# vulkan support
pacman -S vulkan-radeon lib32-vulkan-radeon --noconfirm
# accelerated video decoding
pacman -S libva-mesa-driver lib32-libva-mesa-driver --noconfirm
# "20-amdgpu.conf" will be copied in the config section.
fi
}
tui() {
# install packages for a seamless terminal workflow.
apps=(
'ghostty' # terminal emulator
'fish' # user-friendly shell
'fisher' # fish package manager
'starship' # shell prompt
'tldr' # concise command examples
'exa' # alternative to `ls`
'bat' # alternative to `cat`
'tree' # list contents of dir in a tree-like format
'btop' # task manager
'ncdu' # disk util info
'rsync' # copying tool
'cmus' # music player
'git' # version control
'github-cli'
)
for app in "${apps[@]}"; do
pacman -S "$app" --noconfirm --needed
done
# set preset for starship prompt
starship preset nerd-font-symbols -o ~/.config/starship.toml
# clone suckless fork. (this command also creates .config dir as root)
git clone https://github.com/commitsovercoffee/suckless.git /home/hope/.config/suckless
# install suckless terminal
# cd /home/hope/.config/suckless/st
# make clean install
cd "$current_dir"
# set theme for fish shell.
fish -c "fisher install catppuccin/fish"
fish -c "fish_config theme save "Catppuccin Mocha""
# set defaults.
chsh --shell /bin/fish hope
echo "export VISUAL=nvim" | tee -a /etc/profile
echo "export EDITOR=nvim" | tee -a /etc/profile
echo "export TERMINAL=st" | tee -a /etc/profile
# set git defaults
git config --global user.name commitsovercoffee
git config --global user.email commitsovercoffee@gmail.com
}
editor() {
# install packages for a seamless editor experience.
apps=(
# Neovim ------------------------------------------------------
'neovim' # text editor
'tree-sitter' # parsing library
'fd' # file search
'ripgrep' # search tool that combines the usability of ag with the raw speed of grep
'xclip' # clipboard manipulation tool
# LSP & Formatter ---------------------------------------------
'lua-language-server' # lua
'stylua' # lua formatter
'bash-language-server' # bash
'shfmt' # bash formatter
'vscode-html-languageserver' # html
'vscode-css-languageserver' # css
'tailwind-language-server' # tailwind
'nodejs' # evented io for V8 js
'pnpm' # package manager for js
'svelte-language-server' # svelte
'prettier' # html, css, js, md, bash etc formatter
'go' # golang
'gopls' # golang lsp
'gofumpt' # golang formatter
# install rust as per official doc
# install rust-analyzer : rustup component add rust-analyzer
)
for app in "${apps[@]}"; do
pacman -S "$app" --noconfirm --needed
done
}
gui() {
apps=(
# install display server :
'xorg-server' # xorg display server.
'xorg-xinit' # xinit ~ to start xorg server.
'xorg-xrandr' # tui for RandR extension.
'xorg-xclipboard' # xclipboard ~ clipboard manager.
# install graphical utils :
# 'picom' # X compositor.
'dunst' # notification daemon.
'xbindkeys' # bind commands to certain keys.
'libnotify' # lib to send desktop notifications.
'brightnessctl' # control brightness.
'xautolock' # autolocker.
'lxrandr-gtk3' # monitor configuration.
'cbatticon' # battery for systray.
'feh' # desktop wallpaper.
'gnome-themes-extra' # window themes.
'papirus-icon-theme' # icon themes.
'xfce4-appfinder' # alt app menu.
'lxappearance-gtk3' # theme switcher.
'lxinput-gtk3' # configure keyboard & mouse.
'pcmanfm-gtk3' # file manager.
'firefox' # browser.
'obs-studio' # recording software.
)
for app in "${apps[@]}"; do
pacman -S "$app" --noconfirm --needed
done
# install dynamic window manager.
cd /home/hope/.config/suckless/dwm
make clean install
cd "$current_dir"
# install slock.
cd /home/hope/.config/suckless/slock
make clean install
cd "$current_dir"
}
users() {
# set the root password.
echo "Specify password for root user. This will be used to authorize root commands."
passwd
# add regular user.
useradd -m -G wheel -s /bin/bash "hope"
# set password for new user.
echo "Specify password for regular user."
passwd "hope"
# enable sudo for wheel group.
sed -i 's/# %wheel ALL=(ALL:ALL) ALL/ %wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
# create directories for user.
pacman -S xdg-user-dirs --noconfirm
xdg-user-dirs-update
mkdir Batcave Jupiter Obsidian Walkman Zion
touch memo.md
}
grub() {
# install required packages.
pacman -S grub efibootmgr --noconfirm
# create directory to mount EFI partition.
mkdir /boot/efi
# mount the EFI partition.
mount /dev/nvme0n1p1 /boot/efi
# install grub.
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
# enable logs.
sed -i 's/loglevel=3 quiet/loglevel=3/' /etc/default/grub
# generate grub config.
grub-mkconfig -o /boot/grub/grub.cfg
}
config() {
# '20-amdgpu.conf'
mv .config/20-amdgpu.conf /etc/X11/xorg.conf.d/20-amdgpu.conf
# 'xinitrc'
mv .config/.xinitrc /home/hope/.xinitrc
# '.xbindkeysrc'
mv .config/.xbindkeysrc /home/hope/.xbindkeysrc
mv .config/.get-vol.sh /home/hope/.get-vol.sh
chmod u+x /home/hope/.get-vol.sh
# 'Xresources'
mv .config/.Xresources /home/hope/.Xresources
# 'picom'
mkdir -p /home/hope/.config/picom
mv .config/picom.conf /home/hope/.config/picom/picom.conf
# 'dunst'
mkdir -p /home/hope/.config/dunst
mv .config/dunstrc /home/hope/.config/dunst/dunstrc
# 'lxappearance'
mkdir -p /home/hope/.config/gtk-3.0
mv .config/settings.ini /home/hope/.config/gtk-3.0
# wallpaper for 'feh'
mkdir -p /home/hope/Pictures
mv .config/wallpaper.jpg /home/hope/Pictures/wallpaper.jpg
# 'ghostty'
mkdir -p /home/hope/.config/ghostty
mv .config/config /home/hope/.config/ghostty/config
# 'fish'
mkdir -p /home/hope/.config/fish/functions
mv .config/config.fish /home/hope/.config/fish/config.fish
mv fish_greeting.fish /home/hope/.config/fish/functions/fish_greeting.fish
# 'starship'
mv .config/starship.toml /home/hope/.config/starship.toml
# 'neovim'
mkdir -p /home/hope/.config/nvim
mv .config/init.lua /home/hope/.config/nvim/init.lua
# 'obs'
mkdir -p /home/hope/.config/obs-studio
mv .config/basic /home/hope/.config/obs-studio
# 'cmus theme'
mkdir -p /home/hope/.config/cmus
mv .config/catppuccin.theme /home/hope/.config/cmus/catppuccin.theme
# 'touchpad'
mv .config/30-touch.conf /etc/X11/xorg.conf.d/30-touch.conf
# reset permissions.
chown -R hope /home/hope/
chown -R :hope /home/hope/
}
misc() {
# recreate the initramfs image
mkinitcpio -P
# enable TRIM for SSDs.
systemctl enable fstrim.timer
# encryption keys
pacman -S seahorse --noconfirm
# bug fix ~ reinstall pambase.
pacman -S pambase --noconfirm
# install apps
apps=(
'gnome-screenshot' # screenshot tool.
'peek' # gif recorder.
'gcolor3' # color picker.
'pcmanfm-gtk3' # file manager.
'unzip' # extract/view .zip archives.
'file-roller' # create/modify archives.
'mtpfs' # read/write to MTP devices.
'libmtp' # MTP support.
'gvfs' # gnome virtual file system for mounting.
'gvfs-mtp' # gnome virtual file system for MTP devices.
'android-tools' # android platform tools.
'android-udev' # udev rules to connect to android.
'firefox' # primary browser.
'firefox-developer-edition' # secondary browser.
'torbrowser-launcher' # tertiary browser.
'gedit' # text editor.
'evince' # doc viewer.
'ristretto' # image viewer.
'xournalpp' # pdf annotation.
'obsidian' # note taking.
'inkscape' # vector art.
'pinta' # paint program.
'obs-studio' # screen cast/record.
'pitivi' # video editor.
'qbittorent' # torrent client.
'nicotine' # soul-seek client.
'gnome-disk-utility' # disk management.
'mpv' # media player.
'handlr' # sets default apps.
)
for app in "${apps[@]}"; do
pacman -S "$app" --noconfirm
done
# set default apps
handlr set 'text/*' gedit.desktop
handlr set 'audio/*' mpv.desktop
handlr set 'video/*' mpv.desktop
handlr set 'image/*' org.xfce.ristretto.desktop
handlr set 'application/pdf' org.gnome.Evince.desktop
}
# mark pwd
current_dir=$PWD
# setup ...
multilib
timezone
locale
users
network
bluetooth
audio
webcam
chipset
gpu
tui
editor
gui
grub
config
misc
# clean dir & exit.
rm -r .config
rm setup.sh