-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-arch-base.sh
executable file
·375 lines (344 loc) · 8.05 KB
/
install-arch-base.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
#!/usr/bin/env bash
set -ex -o pipefail
export hostname=${2:-steve}
export installUser=${3:-cwr}
cat - <<'EOINTRO'
Set up the base system the following way:
EFI partition on /boot
ROOT on / (^_^)
EOINTRO
if [ "$1" = "iso" ]; then
if grep -q -i intel /proc/cpuinfo; then
ucode="intel-ucode"
elif grep -q -i amd /proc/cpuinfo; then
ucode="amd-ucode"
else
echo "Unsupported cpu vendor"
exit 1
fi
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.old
rankmirrors -n 6 /etc/pacman.d/mirrorlist.old > /etc/pacman.d/mirrorlist
pacstrap /mnt --needed \
base \
linux-zen \
linux-zen-headers \
linux-firmware \
base-devel \
git \
zsh \
networkmanager \
nvidia-dkms \
${ucode} \
aria2 \
reflector \
fd
genfstab -U /mnt > /mnt/etc/fstab
cp $0 /mnt/
chmod +x /mnt/$(basename $0)
arch-chroot /mnt /$(basename $0) chroot $hostname $installUser
elif [ "$1" = "chroot" ]; then
hostname="$2"
installUser="$3"
if ! id ${installUser}; then
useradd ${installUser} -d /home/${installUser} -U -m
passwd root
passwd ${installUser}
chsh -s /usr/bin/zsh ${installUser}
chsh -s /usr/bin/zsh root
fi
if ! [ -d /home/${installUser}/.git ]; then
cd /home/${installUser}
git init
git remote add origin [email protected]:cwrau/linux-config.git
git fetch
git reset origin/master
git reset --hard
cd /root
chown -R ${installUser}:${installUser} /home/${installUser}
for f in $(fd --type=symlink --type=file --hidden . /home/${installUser}/rootfs)
do
dir=$(dirname ${f/\/home\/${installUser}\/rootfs/})
mkdir -p $dir
ln -sf ${f} -t $dir
done
unset dir
fi
sed -r -i 's/#(COMPRESSION_OPTIONS=)\(\)/\1(-T0 --ultra -22)/' /etc/mkinitcpio.conf
mkinitcpio -P
bootDisk=$(lsblk -o PKNAME $(findmnt /boot -o SOURCE -n) -n)
bootPartition=$(lsblk -o NAME $(findmnt /boot -o SOURCE -n) -n)
efibootmgr --disk /dev/$bootDisk --part $(cat /sys/block/$bootDisk/$bootPartition/partition) --create --label 'Arch EFISTUB' --loader /vmlinuz-linux-zen --unicode "root=UUID=$(findmnt / -o UUID -n) rw initrd=\\$ucode.img initrd=\initramfs-linux-zen.img quiet vga=current nvidia-drm.modeset=1 cgroup_no_v1=\"all\""
ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc
echo en_US.UTF-8 UTF-8 > /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
echo LC_COLLATE=C >> /etc/locale.conf
echo KEYMAP=us-latin1 > /etc/vconsole.conf
echo ${hostname} > /etc/hostname
cat <<-EOHOSTS > /etc/hosts
127.0.0.1 localhost
127.0.0.1 ${hostname}
EOHOSTS
echo "${installUser} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${installUser}
echo "${installUser}:10000:65536" | tee /etc/subuid /etc/subgid
reflector --save /etc/pacman.d/mirrorlist --protocol https --latest 5 --sort score
multilibLine=$(grep -n "\[multilib\]" /etc/pacman.conf | cut -f1 -d:)
sed -i -r "$multilibLine,$((($multilibLine + 1))) s#^\###g" /etc/pacman.conf
sed -i -r "s#^SigLevel.+\$#SigLevel = PackageRequired#g" /etc/pacman.conf
cd /home/${installUser}
sudo -u ${installUser} /$(basename $0) $hostname $installUser
else
hostname="$1"
if ! paru --version; then
pushd /tmp
[ -d paru-bin ] || git clone https://aur.archlinux.org/paru-bin.git
cd paru-bin
export PKGEXT=.pkg.tar
makepkg -fs
sudo pacman -U paru-bin-*.pkg.tar --noconfirm
popd
fi
sudo pacman -Sy
#startPackages
packages=(
advcp
aria2
autorandr
base
bash-completion
bash-git-prompt
bash-language-server
bat
batsignal
bc
bind
blueman
bluez-utils
bpytop
breeze-hacked-cursor-theme
clipmenu
curl
datagrip
datagrip-jre
deluge-gtk
diff-so-fancy
discord_arch_electron
dnsmasq
dockerfile-language-server-bin
dolphin-emu
dunst
earlyoom
ebtables
edk2-ovmf
efibootmgr
exa
exo
fahcontrol
fahviewer
fd
feh
foldingathome
fprintd
freerdp
freetype2
fwupd
fzf
git
glava
gnome-keyring
gnome-terminal
gnu-netcat
gnupg
google-chrome
gotop-bin
gpmdp
gradle
grub
gvfs
helm
hexchat
howdy
hsetroot
httpie
i3-gaps
i3lock-color
imagemagick
informant
inotify-tools
intel-ucode
intellij-idea-ultimate-edition
intellij-idea-ultimate-edition-jre
jq
k9s
kdeconnect
kexec-tools
kube-linter-bin
kubectl-bin
kubefwd-bin
lab-bin
less
lib32-nvidia-utils
libfprint-2-tod1-xps9300-bin
libfprint-tod-git
libgnome-keyring
libinput-gestures
libopenaptx
libu2f-host
libva-mesa-driver
linux
linux-firmware
linux-headers
lscolors-git
man-db
man-pages
matcha-gtk-theme
mesa
meta-group-base-devel
mitmproxy
moreutils
morsetran
mpv
mpv-mpris
multimc5
ncdu
neovim-drop-in
neovim-plug
nerd-fonts-complete
net-tools
network-manager-applet
networkmanager-dmenu-git
networkmanager-openvpn
nmap
nodejs-neovim
notify-send.sh
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
noto-fonts-extra
nss-mdns
nvidia
nvtop
ocl-icd
oh-my-zsh-git
opencl-nvidia
openjdk-src
openssh
pacman-contrib
papirus-icon-theme
pavucontrol
pcmanfm
perl-anyevent-i3
perl-file-mimeinfo
picom
pkgstats
playerctl
podman
polkit
polkit-gnome
polybar
polybar-scripts-git
powertop
premid
prettyping
procs
proton-ge-custom-bin
pulseaudio
pulseaudio-bluetooth
pv
python-dynmen
python-notify2
python-pip
python-pulsectl
python-pynvim
python-rope
python-traitlets
python-virtualenv
qemu
realvnc-vnc-viewer
redshift
reflector
remmina
ripgrep
rke-bin
rofi-dmenu
scrot
shfmt
signal-desktop
siji-git
slack-electron
slit-git
socat
sof-firmware
splatmoji-git
steam
steam-tweaks
sxiv
systemd
systemd-boot-pacman-hook
teams-insiders
telegram-desktop
telepresence
traceroute
tree
ttf-dejavu
ttf-fira-code
ttf-font-awesome
ttf-liberation
tty-clock
udiskie-dmenu-git
uhk-agent-appimage
unzip
usbutils
virt-manager
whatsapp-nativefier-arch-electron
which
xarchiver
xclip
xorg-server
xorg-xinit
xorg-xinput
xorg-xkill
xorg-xprop
xorg-xwininfo
xss-lock-session
paru-bin
yq
ytmdesktop
yubico-pam
zip
zoom
zsh
zsh-autosuggestions
zsh-completions
zsh-syntax-highlighting
zsh-theme-powerlevel10k-git
zsh-you-should-use
)
#endPackages
prePackages=(
libfprint-2-tod1-xps9300-bin
libfprint-tod-git
neovim-drop-in
nodejs-lts-dubnium
rofi-dmenu
)
paru -Syu --noconfirm --needed --removemake --asdeps ${prePackages[@]}
paru -Syu --noconfirm --needed --removemake --asexplicit ${packages[@]}
sudo usermod -a -G wheel,uucp,input,video $USER
sudo ln -sf Breeze_Hacked /usr/share/icons/default
nvim +PlugInstall +exit +exit
mkdir -p ${HOME}/Screenshots
sudo chmod u+s $(which i3lock)
if ! grep -q pam_gnome_keyring.so /etc/pam.d/login; then
authSectionEnd="$(grep -n ^auth /etc/pam.d/login | sort -n | tail -1 | sed -r 's#^([0-9]+):.+$#\1#g')"
sessionSectionEnd="$(grep -n ^session /etc/pam.d/login | sort -n | tail -1 | sed -r 's#^([0-9]+):.+$#\1#g')"
sudo sed -i -r "$(($authSectionEnd + 1))i auth optional pam_gnome_keyring.so" /etc/pam.d/login
if [[ "$((sessionSectionEnd + 1))" -ge "$(wc -l </etc/pam.d/login)" ]]; then
sudo sed -i -r "$ a session optional pam_gnome_keyring.so auto_start" /etc/pam.d/login
else
sudo sed -i -r "$(($sessionSectionEnd + 1))i session optional pam_gnome_keyring.so auto_start" /etc/pam.d/login
fi
fi
sudo systemctl enable systemd-timesyncd bluetooth pkgstats.timer fwupd ebtables fwupd-refresh.timer NetworkManager reflector.timer auto-cpufreq.service ananicy-cpp.service
fi