-
Notifications
You must be signed in to change notification settings - Fork 3
/
install-system-to-ssd.sh
executable file
·62 lines (47 loc) · 1.46 KB
/
install-system-to-ssd.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
#!/bin/bash
DEVICE=${DEVICE:-/dev/nvme0n1}
# Create a partition that occupy every space on the disk
sgdisk --clear --new=1:0:0 $DEVICE
mkfs.ext4 ${DEVICE}p1
mount ${DEVICE}p1 /mnt
pacstrap -K /mnt base linux linux-firmware vim openssh sudo
genfstab -U /mnt >> /mnt/etc/fstab
arch-chroot /mnt ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
arch-chroot /mnt hwclock --systohc
echo "en_US.UTF-8 UTF-8" >> /mnt/etc/locale.gen
arch-chroot /mnt locale-gen
echo "LANG=en_US.UTF-8" > /mnt/etc/locale.conf
tee -a /mnt/etc/systemd/network/end0.network << END
[Match]
Name=end0
[Network]
DHCP=yes
END
mkdir -p /mnt/boot/extlinux
tee -a /mnt/boot/extlinux/extlinux.conf << END
default arch
menu title U-Boot menu
prompt 0
timeout 50
label arch
menu label Arch Linux
linux /boot/vmlinuz-linux
initrd /boot/initramfs-linux.img
fdtdir /boot/dtbs/
append root=${DEVICE}p1 rw earlycon
label arch-fallback
menu label Arch Linux (Fallback)
linux /boot/vmlinuz-linux
initrd /boot/initramfs-linux-fallback.img
fdtdir /boot/dtbs/
append root=${DEVICE}p1 rw earlycon
END
cp -r /mnt/usr/share/dtbs/*-arch*/ /mnt/boot/dtbs
echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" >> /mnt/etc/sudoers
ensure_services=(systemd-timesyncd systemd-networkd systemd-resolved sshd)
for service in ${ensure_services[@]}; do
arch-chroot /mnt systemctl enable "$service"
done
usermod --root $(realpath /mnt) --password $(openssl passwd -6 "archriscv") root
cp add-packager.sh /mnt/root
umount -l /mnt