-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstaller
executable file
·259 lines (226 loc) · 6.73 KB
/
installer
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
#!/usr/bin/env bash
echo
echo "############################################"
echo "########### Arch Linux Installer ###########"
echo "############################################"
echo "Check out the Arch Linux Installation Guide"
echo "############################################"
echo
# Set the keyboard layout
loadkeys ru
# Check EFI boot mode
table=`ls /sys/firmware/efi/efivars 2>&1 | grep -o "cannot access"`
if [[ "$table" == "cannot access" ]]; then
table="BIOS"
else
table="UEFI"
fi
# Check network
ip link
ping -c3 archlinux.org
# Update the system clock
timedatectl set-ntp true
sleep 3; echo
timedatectl status
echo
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
# Create disk table; format and mount it
lsblk; echo
echo
echo "####################"
echo "Boot mode is $table"
echo "####################"
while [[ $am != "1" ]] && [[ $am != "2" ]]; do
echo "Please, choose:"
echo "1) auto mount mode - only for /dev/vda"
echo "2) manual mount mode"
echo "####################"
read -n1 -p">" am
done
echo
if [[ $table == "UEFI" ]]; then
if [[ $am == "1" ]]; then
echo
echo "####################"
echo "Important:"
echo "Select label type: gpt"
echo "Create the following new partions:"
echo "/dev/vda1 - for efi"
echo "/dev/vda2 - for swap"
echo "/dev/vda3 - for root"
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
cfdisk
lsblk
echo
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
mkfs.fat -F32 /dev/vda1
mkswap /dev/vda2
mkfs.ext4 /dev/vda3
mount /dev/vda3 /mnt
swapon /dev/vda2
mkdir -p /mnt/boot/efi
mount /dev/vda1 /mnt/boot/efi
else
echo
echo "####################"
echo "Important:"
echo "Select label type: gpt"
echo "/mnt - for root"
echo "/mnt/boot/efi - for efi"
echo "####################"
echo "1 - cfdisk, fdisk, gdisk - partitions manager"
echo "2 - lsblk or lsblk -fs - show partitions"
echo "3 - mkfs.ext4 /dev/sdX, mkfs.fat -F32 /dev/sdY - for format"
echo "4 - mount /dev/sdX /mnt - for mount /"
echo "5 - mkdir -p /mnt/boot/efi - create dir for EFI"
echo "6 - mount /dev/sdY /mnt/boot/efi - for mount /boot/efi"
echo "7 - mkswap /dev/sdZ; swapon /dev/sdZ - for swap"
echo "####################"
echo "after in shell do: # exit"
echo "####################"
bash
fi
else
if [[ $am == "1" ]]; then
echo
echo "####################"
echo "Important:"
echo "Select label type: dos"
echo "Create the following new partions:"
echo "/dev/vda1 - for swap"
echo "/dev/vda2 - for root"
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
cfdisk
lsblk
echo
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
mkswap /dev/vda1
mkfs.ext4 /dev/vda2
mount /dev/vda2 /mnt
swapon /dev/vda1
else
echo
echo "####################"
echo "Important:"
echo "Select label type: dos"
echo "/mnt - for root"
echo "####################"
echo "1 - cfdisk, fdisk - partitions manager"
echo "2 - lsblk or lsblk -fs - show partitions"
echo "3 - mkfs.ext4 /dev/sdX - for format"
echo "4 - mount /dev/sdX /mnt - for mount"
echo "5 - mkswap /dev/sdY; swapon /dev/sdY - for swap"
echo "####################"
echo "after in shell do: # exit"
echo "####################"
bash
fi
fi
echo
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
# Install base packages
# grub
while [[ $grub != "1" ]] && [[ $grub != "2" ]]; do
echo "####################"
echo "Install grub:"
echo "1) yes"
echo "2) no"
echo "####################"
read -n1 -p">" grub
done
echo; echo
if [[ $grub == "1" ]]; then
if [[ $table == "UEFI" ]]; then
grub="grub os-prober efibootmgr grub-theme-vimix"
else
grub="grub os-prober grub-theme-vimix"
fi
else
grub=""
fi
# kernel
while [[ $kernel != "1" ]] && [[ $kernel != "2" ]] && [[ $kernel != "3" ]] && [[ $kernel != "4" ]]; do
echo "####################"
echo "Install what kernel:"
echo "1) linux - Vanilla Linux kernel"
echo "2) linux-lts - LTS Linux kernel"
echo "3) linux-zen - Zen Linux kernel"
echo "4) linux-hardened - Security-focused Linux kernel"
echo "####################"
read -n1 -p">" kernel
done
echo; echo
if [[ $kernel == "1" ]]; then
kernel="linux"
elif [[ $kernel == "2" ]]; then
kernel="linux-lts"
elif [[ $kernel == "3" ]]; then
kernel="linux-zen"
elif [[ $kernel == "4" ]]; then
kernel="linux-hardened"
else
kernel=""
fi
packages="archlinux-keyring base base-devel $kernel linux-firmware $grub networkmanager nano curl"
pacstrap /mnt $packages
# Generate /etc/fstab
genfstab -U /mnt >> /mnt/etc/fstab
echo; echo
cat /mnt/etc/fstab
echo
echo "####################"
echo "Click any key; ctrl-c is abort"
echo "####################"
read -n1 -p">"; echo
# Copy script for chroot mode
cp -r /root/archlinux /mnt/root
echo
if [[ "$grub" == "grub os-prober" ]] && [[ $am == "2" ]]; then
echo "####################"
echo "In chroot mode do:"
echo ">/root/archlinux/chroot /dev/sdX"
echo "where /dev/sdX - disk for install grub"
echo "####################"
else
echo "####################"
echo "In chroot mode do:"
echo ">/root/archlinux/chroot"
echo "####################"
fi
# Run arch-chroot
arch-chroot /mnt
# Clean
rm -rf /mnt/root/archlinux
umount -R /mnt
echo; echo
echo "####################"
echo "Please do this:"
echo ">poweroff or >reboot"
echo "Disable flash or disk"
echo "####################"
echo
echo "####################"
echo "After reboot run your user and"
echo "Please do this:"
echo ">cd ~/archlinux && ./packages"
echo "####################"
echo "####################"
echo