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 |
d5dc58
|
10 |
printf "n\np\n\n\n\nw\n" | fdisk $DISK |
JG |
11 |
#( |
|
12 |
#echo n # Add a new partition |
|
13 |
#echo p # Primary partition |
|
14 |
#echo # Partition number |
|
15 |
#echo # First sector (Accept default: 1) |
|
16 |
#echo # Last sector (Accept default: varies) |
|
17 |
#echo w # Write changes |
|
18 |
#) | fdisk $DISK |
2d9860
|
19 |
mkfs.ext4 "$DISK$PARTNO" |
3b93d4
|
20 |
|
JG |
21 |
# Mount and install |
2d9860
|
22 |
mount "$DISK$PARTNO" /mnt |
JG |
23 |
pacstrap /mnt base linux linux-firmware grub dhcpcd vim qemu-guest-agent |
3b93d4
|
24 |
genfstab -U /mnt >> /mnt/etc/fstab |
JG |
25 |
|
2d9860
|
26 |
# Setup locale |
JG |
27 |
arch-chroot /mnt ln -sf /usr/share/zoneinfo/UTC /etc/localtime |
|
28 |
sed -i -e "s/#$LOCALE/$LOCALE/" /mnt/etc/locale.gen |
|
29 |
arch-chroot /mnt locale-gen |
|
30 |
echo "LANG=$LOCALE" > /mnt/etc/locale.conf |
d5dc58
|
31 |
|
JG |
32 |
# Set hostname and make hosts file |
2d9860
|
33 |
echo $HOSTNAME > /mnt/etc/hostname |
JG |
34 |
printf "127.0.0.1\tlocalhost\n::1\t\tlocalhost\n127.0.1.1\t$HOSTNAME.localdomain $HOSTNAME" > /mnt/etc/hosts |
d5dc58
|
35 |
|
JG |
36 |
# Enable networking on boot and qemu guest agent |
2d9860
|
37 |
arch-chroot /mnt systemctl enable dhcpcd qemu-ga |
d5dc58
|
38 |
|
JG |
39 |
# Make boot files and setup grub |
2d9860
|
40 |
arch-chroot /mnt mkinitcpio -P |
JG |
41 |
arch-chroot /mnt sh -c "echo root:$RPASS | chpasswd" |
d5dc58
|
42 |
sed "s/GRUB_TIMEOUT=\d*/GRUB_TIMEOUT=\"0\"/" /mnt/etc/default/grub |
2d9860
|
43 |
arch-chroot /mnt grub-install $DISK |
JG |
44 |
arch-chroot /mnt grub-mkconfig -o /boot/grub/grub.cfg |
3b93d4
|
45 |
|
d5dc58
|
46 |
# Add my repo to pacman.conf |
JG |
47 |
printf "[Chizi123]\nSigLevel = Optional TrustAll\nServer = https://repo.joelg.cf/x86_64\n" >> /mnt/etc/pacman.conf |
|
48 |
|
3b93d4
|
49 |
reboot |