mirror of https://github.com/Chizi123/Scripts.git

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