commit | author | age
|
3b93d4
|
1 |
#!/bin/bash |
JG |
2 |
|
|
3 |
HOSTNAME=VM |
|
4 |
RPASS=root |
2d9860
|
5 |
DISK=/dev/vda |
JG |
6 |
PARTNO=1 |
|
7 |
LOCALE=en_US.UTF-8 |
3b93d4
|
8 |
|
JG |
9 |
# Partition disk |
|
10 |
( |
|
11 |
echo n # Add a new partition |
|
12 |
echo p # Primary partition |
2d9860
|
13 |
echo # Partition number |
3b93d4
|
14 |
echo # First sector (Accept default: 1) |
JG |
15 |
echo # Last sector (Accept default: varies) |
|
16 |
echo w # Write changes |
2d9860
|
17 |
) | sudo fdisk $DISK |
JG |
18 |
mkfs.ext4 "$DISK$PARTNO" |
3b93d4
|
19 |
|
JG |
20 |
# Mount and install |
2d9860
|
21 |
mount "$DISK$PARTNO" /mnt |
JG |
22 |
pacstrap /mnt base linux linux-firmware grub dhcpcd vim qemu-guest-agent |
3b93d4
|
23 |
genfstab -U /mnt >> /mnt/etc/fstab |
JG |
24 |
|
2d9860
|
25 |
# Setup locale |
JG |
26 |
arch-chroot /mnt ln -sf /usr/share/zoneinfo/UTC /etc/localtime |
|
27 |
sed -i -e "s/#$LOCALE/$LOCALE/" /mnt/etc/locale.gen |
|
28 |
arch-chroot /mnt locale-gen |
|
29 |
echo "LANG=$LOCALE" > /mnt/etc/locale.conf |
|
30 |
echo $HOSTNAME > /mnt/etc/hostname |
|
31 |
printf "127.0.0.1\tlocalhost\n::1\t\tlocalhost\n127.0.1.1\t$HOSTNAME.localdomain $HOSTNAME" > /mnt/etc/hosts |
|
32 |
arch-chroot /mnt systemctl enable dhcpcd qemu-ga |
|
33 |
arch-chroot /mnt mkinitcpio -P |
|
34 |
arch-chroot /mnt sh -c "echo root:$RPASS | chpasswd" |
|
35 |
arch-chroot /mnt grub-install $DISK |
|
36 |
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg |
3b93d4
|
37 |
|
JG |
38 |
reboot |