Created
July 19, 2021 18:22
-
-
Save udf/c4b0ae3e0a9990d38177532ddfdb0f65 to your computer and use it in GitHub Desktop.
Arch Linux TAS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
### mirror setup | |
# mkdir /tmp/pkg | |
# cd /tmp/pkg | |
# ln -s /var/lib/pacman/sync/*.db . | |
# ln -s /var/cache/pacman/pkg/* . | |
# python -m http.server 8080 | |
ISOFILE=archlinux-2021.07.01-x86_64.iso | |
mkdir -p /tmp/arch | |
cd /tmp/arch | |
cp -n ~/Downloads/$ISOFILE . | |
rm -f arch.img | |
qemu-img create -f qcow2 arch.img 4G | |
{ | |
cat <<EOF | |
set timeout -1 | |
spawn qemu-system-x86_64 -enable-kvm -boot d -drive file=arch.img -m 2G -cdrom $ISOFILE -cpu host -smp 8 -serial stdio -boot order=c | |
# Edit boot options and enable serial console | |
expect "Arch Linux install" | |
send "\t console=ttyS0\n" | |
expect "login:" | |
send "root\n" | |
# Partition and format the drive | |
# Stop reflector, set the mirror server, disable signature verification, and install the system | |
expect "@archiso" | |
send "parted /dev/sda mklabel msdos mkpart primary 0% 100%; mkfs.ext4 /dev/sda1; mount /dev/sda1 /mnt; systemctl stop reflector; echo 'Server = http://10.0.2.2:8080' > /etc/pacman.d/mirrorlist; sed -i 's/Required DatabaseOptional/Never/' /etc/pacman.conf; pacstrap /mnt base linux grub; arch-chroot /mnt; reboot\n" | |
# Disable grub timeout and install grub | |
expect "]# " | |
send "sed -i 's/OUT=5/OUT=0/' /etc/default/grub; grub-install /dev/sda; grub-mkconfig -o /boot/grub/grub.cfg; exit\n" | |
expect eof | |
EOF | |
} | expect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment