Skip to content

Instantly share code, notes, and snippets.

@kuzzmi
Last active May 12, 2017 17:30
Show Gist options
  • Save kuzzmi/01a96350fb4c9051888121deab9947e5 to your computer and use it in GitHub Desktop.
Save kuzzmi/01a96350fb4c9051888121deab9947e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
timedatectl set-ntp true
curl -sL "https://www.archlinux.org/mirrorlist/?country=DE&country=CH&country=UA&protocol=http&protocol=https&ip_version=4" > /etc/pacman.d/mirrorlist.new
sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist.new
rankmirrors -n 6 /etc/pacman.d/mirrorlist.new > /etc/pacman.d/mirrorlist
(
#echo o # Create a new empty DOS partition table
echo n # Add /boot partition
echo p # Primary partition
echo 1 # Partition number
echo # First sector (default)
echo +100M # Last sector
#
echo n # Add / partition
echo p # Primary partition
echo #
echo # Allocating 4GB for /
echo +4G #
#
echo n # Add /home partition
echo p #
echo #
echo #
echo #
echo w # Write changes
) | sudo fdisk /dev/sda
mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2
mkfs.ext4 /dev/sda3
mount /dev/sda2 /mnt
mkdir /mnt/boot
mkdir /mnt/home
mount /dev/sda1 /mnt/boot
mount /dev/sda3 /mnt/home
pacstrap /mnt base
pacman -S grub
genfstab -U /mnt >> /mnt/etc/fstab
cat >/mnt/home/post-chroot.sh << EOF
ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime
hwclock --systohc
echo en_US.UTF-8 UTF-8 > /etc/locale.gen
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
echo KEYMAP=colemak > /etc/vconsole.conf
echo archvm > /etc/hostname
echo 127.0.1.1 archvm.localdomain archvm >> /etc/hosts
pacman -S --noconfirm linux
pacman -S --noconfirm grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
exit
EOF
chmod +x /mnt/home/post-chroot.sh
arch-chroot /mnt /home/post-chroot.sh
umount -R /mnt
# reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment