-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharch.sh
336 lines (307 loc) · 10.3 KB
/
arch.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
#!/bin/bash
# # ---------------------------------------------
# # Connect to WiFi:
# # ---------------------------------------------
#
# # Get network device name
# ip -c a
#
# # Connect to network
# iwctl
# [iwd] station wlan0 connect MyWirelessNetwork
#
# # Test connection by refreshing packages
# pacman -Sy
#
#
# # ---------------------------------------------
# # Preconfigure:
# # ---------------------------------------------
#
# # Ensure booted with EFI mode
# ls /sys/firmware/efi/efivars
#
# # Set and check time
# timedatectl set-ntp true
# timedatectl status
#
#
# # ---------------------------------------------
# # Partition & format data disk (if applicable):
# # ---------------------------------------------
#
# # List devices
# lsblk -f
#
# # Create partitions
# cgdisk /dev/sda
# #- data: NEW, default, default, 8300
#
# # Format data partition
# mkfs.btrfs -L data /dev/sda1
#
# # Create btrfs subvolumes
# mount /dev/sda1 /mnt
# cd /mnt
# btrfs subvolume create @
# btrfs subvolume create @data
# btrfs subvolume create @volumes
# cd / && umount /mnt
#
# # ---------------------------------------------
# # Partition & format raid disk (if applicable):
# # ---------------------------------------------
#
# # List devices
# lsblk -f
#
# # Create partitions
# cgdisk /dev/sdb
# #- raid: NEW, default, default, 8300
#
# # Format data partition
# mkfs.btrfs -L raid /dev/sdb1
#
# # Create btrfs subvolumes
# mount /dev/sdb1 /mnt
# cd /mnt
# btrfs subvolume create @
# btrfs subvolume create @archives
# btrfs subvolume create @audiobooks
# btrfs subvolume create @books
# btrfs subvolume create @games
# btrfs subvolume create @movies
# btrfs subvolume create @music
# btrfs subvolume create @photos
# btrfs subvolume create @series
# btrfs subvolume create @videos
# cd / && umount /mnt
#
# # ---------------------------------------------
# # Partition & format root disk:
# # ---------------------------------------------
#
# # List devices
# lsblk -f
#
# # Create partitions
# cgdisk /dev/nvme0n1
# #- boot: NEW, default, 512M, ef00
# #- swap: NEW, default, 32G, 8200
# #- root: NEW, default, default, 8300
#
# # Format boot partition
# mkfs.fat -F32 /dev/nvme0n1p1
#
# # Format swap partition
# mkswap /dev/nvme0n1p2
# swapon /dev/nvme0n1p2
#
# # Format root partition
# mkfs.btrfs -L root /dev/nvme0n1p3
#
# # Create btrfs subvolumes
# mount /dev/nvme0n1p3 /mnt
# cd /mnt
# btrfs subvolume create @
# btrfs subvolume create @home
# btrfs subvolume create @log
# btrfs subvolume create @docker
# cd / && umount /mnt
#
# # ---------------------------------------------
# # Mount volumes:
# # ---------------------------------------------
#
# # Mount root subvolume
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@ /dev/nvme0n1p3 /mnt
#
# # Mount boot partition
# mkdir /mnt/boot
# mount /dev/nvme0n1p1 /mnt/boot
#
# # Mount home subvolume
# mkdir /mnt/home
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@home /dev/nvme0n1p3 /mnt/home
#
# # Mount log subvolume
# mkdir -p /mnt/var/log
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@log /dev/nvme0n1p3 /mnt/var/log
#
# # Mount docker subvolume
# mkdir -p /mnt/var/lib/docker
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@docker /dev/nvme0n1p3 /mnt/var/lib/docker
#
# # Mount data subvolume (if applicable):
# mkdir /mnt/data
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@data /dev/sda1 /mnt/data
#
# # Mount data volumes subvolume (if applicable):
# mkdir /mnt/var/lib/docker/volumes
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@volumes /dev/sda1 /mnt/var/lib/docker/volumes
#
# # Mount archives subvolume (if applicable):
# mkdir /mnt/data/archives
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@archives /dev/sdb1 /mnt/data/archives
#
# # Mount audiobooks subvolume (if applicable):
# mkdir /mnt/data/audiobooks
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@audiobooks /dev/sdb1 /mnt/data/audiobooks
#
# # Mount books subvolume (if applicable):
# mkdir /mnt/data/books
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@books /dev/sdb1 /mnt/data/books
#
# # Mount games subvolume (if applicable):
# mkdir /mnt/data/games
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@games /dev/sdb1 /mnt/data/games
#
# # Mount movies subvolume (if applicable):
# mkdir /mnt/data/movies
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@movies /dev/sdb1 /mnt/data/movies
#
# # Mount music subvolume (if applicable):
# mkdir /mnt/data/music
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@music /dev/sdb1 /mnt/data/music
#
# # Mount photos subvolume (if applicable):
# mkdir /mnt/data/photos
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@photos /dev/sdb1 /mnt/data/photos
#
# # Mount series subvolume (if applicable):
# mkdir /mnt/data/series
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@series /dev/sdb1 /mnt/data/series
#
# # Mount videos subvolume (if applicable):
# mkdir /mnt/data/videos
# mount -o noatime,compress=zstd,space_cache=v2,discard=async,subvol=@videos /dev/sdb1 /mnt/data/videos
#
#
# # ---------------------------------------------
# # Create fstab from mounts:
# # ---------------------------------------------
#
# # Verify partitions and subvolumes
# lsblk -f
# btrfs subvolume list /mnt
#
# # Generate fstab
# genfstab -U /mnt >> /mnt/etc/fstab
#
#
# # ---------------------------------------------
# # Install base packages:
# # ---------------------------------------------
#
# # Install base packages to new volume
# pacstrap /mnt base base-devel linux linux-firmware git vim intel-ucode
#
#
# # ---------------------------------------------
# # Enter system and run install script:
# # ---------------------------------------------
#
# # Enter installation
# arch-chroot /mnt
#
# # Download install script, edit and run
# git clone https://github.com/suderman/dotfiles.git /tmp/dotfiles
# sh /tmp/dotfiles/arch.sh
#
#
# Timezone
ln -sf /usr/share/zoneinfo/Canada/Mountain /etc/localtime
hwclock --systohc
# Locale
echo "LANG=en_US.UTF-8" >> /etc/locale.conf
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
# Hostname (change for each device)
export HOSTNAME=arch
echo "$HOSTNAME" >> /etc/hostname
echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1 localhost" >> /etc/hosts
echo "127.0.1.1 $HOSTNAME.localdomain $HOSTNAME" >> /etc/hosts
# Root password
echo root:password | chpasswd
# Packages
pacman -Syy
pacman -S acpi acpi_call acpid alsa-utils arch-install-scripts avahi bash-completion bluez bluez-utils bridge-utils cups dialog dnsmasq dnsutils dosfstools edk2-ovmf efibootmgr firewalld flatpak grub grub-btrfs gvfs gvfs-smb hplip inetutils ipset iptables-nft linux-headers man-db mtools network-manager-applet nfs-utils nss-mdns ntfs-3g openbsd-netcat openssh os-prober pipewire pipewire-alsa pipewire-jack pipewire-pulse qemu qemu-arch-extra reflector rsync sof-firmware tlp vde2 virt-manager wpa_supplicant xdg-user-dirs xdg-utils zsh
# Enable Grub's OS prober
echo GRUB_DISABLE_OS_PROBER=false >> /etc/default/grub
# Add deep suspend to kernel parameters
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=".*"/GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet mem_sleep_default=deep"/' /etc/default/grub
# Install and config Grub
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB
grub-mkconfig -o /boot/grub/grub.cfg
# System Services
systemctl enable NetworkManager
systemctl enable bluetooth
systemctl enable cups.service
systemctl enable sshd
systemctl enable avahi-daemon
systemctl enable tlp
systemctl enable reflector.timer
systemctl enable fstrim.timer
systemctl enable libvirtd
systemctl enable firewalld
systemctl enable acpid
# Install paru
cd /tmp
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
# Install & configure Docker for bfrfs
pacman -S docker
mkdir -p /etc/docker
echo '{' >> /etc/docker/daemon.json
echo ' "storage-driver": "btrfs"' >> /etc/docker/daemon.json
echo '}' >> /etc/docker/daemon.json
systemctl enable docker
# Install Gnome
pacman -S gnome
systemctl enable gnome
# Configure Interception caps2esc
pacman -S interception-caps2esc
mkdir -p /etc/interception/udevmon.d
echo '- JOB: intercept -g $DEVNODE | caps2esc -m 1 | uinput -d $DEVNODE' >> /etc/interception/udevmon.d/caps2esc.yaml
echo ' DEVICE:' >> /etc/interception/udevmon.d/caps2esc.yaml
echo ' EVENTS:' >> /etc/interception/udevmon.d/caps2esc.yaml
echo ' EV_KEY: [KEY_CAPSLOCK, KEY_ESC]' >> /etc/interception/udevmon.d/caps2esc.yaml
systemctl enable udevmon
# Install tailscale
pacman -S tailscale
systemctl enable tailscaled
# User
useradd -m me
echo me:password | chpasswd
usermod -aG libvirt me
usermod -aG docker me
echo "me ALL=(ALL) ALL" >> /etc/sudoers.d/me
chsh -s /usr/bin/zsh me
# Override system's gnome-terminal with script in user's .local/bin directory
ln -sf /home/me/.local/bin/gnome-terminal /usr/local/bin/gnome-terminal
chown -R me:me /usr/local/bin
# Done
printf "\e[1;32mDone! Reboot and login as user.\e[0m"
# # ---------------------------------------------
# # Final steps onced logged in as user:
# # ---------------------------------------------
#
# # Goodies
# sudo pacman -S --needed neovim neomutt mosh zsh tmux fzf ncdu ranger micro htop jq lazydocker firefox
# paru -S --needed foot lf-bin
#
# # https://github.com/harshadgavali/searchprovider-for-browser-tabs/
# xdg-open https://addons.mozilla.org/firefox/downloads/file/3887875/tab_search_provider_for_gnome-1.0.1-fx.xpi
# gnome-extensions install https://extensions.gnome.org/extension-data/browser-tabscom.github.harshadgavali.v4.shell-extension.zip
# paru -S --needed tabsearchproviderconnector
#
# # Gnome settings
# gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"
# gsettings get org.gnome.desktop.peripherals.touchpad disable-while-typing
#
# # Install ydotool
# paru -S --needed ydotool
# sudo usermod -aG input me
# systemctl --user enable --now ydotoold