-
Notifications
You must be signed in to change notification settings - Fork 3
/
0-root-install-init.sh
135 lines (117 loc) · 4.11 KB
/
0-root-install-init.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
#!/bin/bash
# set some colors
CNT="[\e[1;36mNOTE\e[0m]"
COK="[\e[1;32mOK\e[0m]"
CER="[\e[1;31mERROR\e[0m]"
CAT="[\e[1;37mATTENTION\e[0m]"
CWR="[\e[1;35mWARNING\e[0m]"
CAC="[\e[1;33mACTION\e[0m]"
# cfdisk -> /efi 100M,
# setting timedate
echo -e "\n$CNT starting settings timedate ....................."
timedatectl set-ntp true
sleep 1
timedatectl set-timezone Asia/Shanghai
echo -e "\n$CAC timedate done ...................."
sleep 1
# mkfs
echo -e "\n$CNT starting mkfs ....................."
sleep 1
mkfs.fat -F32 /dev/nvme0n1p1
echo -e "\n$CAC nvme0n1p1 done ...................."
sleep 1
# 如果是多磁盘还需要加上磁盘阵列 例如: -d raid0 -m raid1
mkfs.btrfs -f -L "MyArch" --checksum xxhash /dev/nvme0n1p2
echo -e "\n$CAC nvme0n1p2 done ...................."
sleep 1
# mkfs.btrfs -f /dev/nvme0n1p1
# echo -e "\n$CAC nvme0n1p1 done ...................."
# sleep 1
# mount
echo -e "\n$CNT starting create subvolume ...................."
sleep 1
mount /dev/nvme0n1p2 /mnt
sleep 1
btrfs sub create /mnt/@
# sleep 1
# btrfs sub create /mnt/@home
sleep 1
btrfs sub create /mnt/@cache
sleep 1
btrfs sub create /mnt/@log
sleep 1
btrfs sub create /mnt/@swap
# sleep 1
# btrfs sub create /mnt/@docker
# sleep 1
# btrfs sub create /mnt/@libvirt
# sleep 1
# btrfs sub create /mnt/@portables
# sleep 1
# btrfs sub create /mnt/@machines
# sleep 1
sleep 1
umount /mnt
echo -e "\n$CAC created subvolume done ...................."
echo -e "\n$CNT starting mount ........................."
sleep 1
mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@ /dev/nvme0n1p2 /mnt
echo -e "\n$CAC root mounted done ...................."
sleep 1
mount /dev/nvme0n1p1 /mnt/efi --mkdir
echo -e "\n$CAC efi mounted done ...................."
# sleep 1
# mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@home /dev/nvme0n1p2 /mnt/home --mkdir
# echo -e "\n$CAC home mounted done ...................."
sleep 1
mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@cache /dev/nvme0n1p2 /mnt/var/cache --mkdir
echo -e "\n$CAC cache mounted done ...................."
sleep 1
mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@log /dev/nvme0n1p2 /mnt/var/log --mkdir
echo -e "\n$CAC log mounted done ...................."
sleep 1
mount -o defaults,subvol=@swap /dev/nvme0n1p2 /mnt/swap --mkdir
echo -e "\n$CAC swap mounted done ...................."
sleep 1
# sleep 1
# mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@docker /dev/nvme0n1p2 /mnt/var/lib/docker --mkdir
# echo -e "\n$CAC docker mounted done ...................."
# sleep 1
# mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@libvirt /dev/nvme0n1p2 /mnt/var/lib/libvirt --mkdir
# echo -e "\n$CAC libvirt mounted done ...................."
# sleep 1
# mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@portables /dev/nvme0n1p2 /mnt/var/lib/portables --mkdir
# echo -e "\n$CAC portables mounted done ...................."
# sleep 1
# mount -o noatime,ssd,compress-force=zstd,nodiscard,subvol=@machines /dev/nvme0n1p2 /mnt/var/lib/machines --mkdir
# echo -e "\n$CAC machines mounted done ...................."
# sleep 1
lsblk
sleep 5
# disable reflector
echo -e "\n$CNT uninstall reflector ........................"
pacman -Rsnu reflector --noconfirm
echo -e "\n$CAC uninstall reflector done ...................."
sleep 1
echo -e "\n$CNT fix mirrorlist ........................."
cat >/etc/pacman.d/mirrorlist <<EOF
Server=https://mirrors.ustc.edu.cn/archlinux/\$repo/os/\$arch
Server=https://mirrors.tuna.tsinghua.edu.cn/archlinux/\$repo/os/\$arch
EOF
echo -e "\n$CAC created subvolume done ...................."
sleep 1
# install system
echo -e "\n$CNT startings install system .........................."
sleep 1
pacstrap /mnt base base-devel linux linux-firmware btrfs-progs neovim networkmanager pacman-contrib
echo -e "\n$CAC install system done ...................."
sleep 1
# gen fstab
echo -e "\n$CNT generator fstab ......................"
genfstab -U /mnt >/mnt/etc/fstab
echo -e "\n$CAC gen fstab done ...................."
sleep 1
# mv script
mv arch-scripts /mnt/root/
# chroot /mnt
echo -e "\n$COK Has been completed. Please >>>>>>>>>>>>>>>> arch-chroot /mnt \n"