From 3b93d4e1dfd409a8a1ac2d4e4839545679aebc2f Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sat, 21 Mar 2020 08:52:22 +0000
Subject: [PATCH] basic arch install script for vm

---
 .gitignore      |    1 +
 arch-install.sh |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e4e5f6c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*~
\ No newline at end of file
diff --git a/arch-install.sh b/arch-install.sh
new file mode 100644
index 0000000..e33e945
--- /dev/null
+++ b/arch-install.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+HOSTNAME=VM
+RPASS=root
+
+# Partition disk
+(
+echo n # Add a new partition
+echo p # Primary partition
+echo 1 # Partition number
+echo   # First sector (Accept default: 1)
+echo   # Last sector (Accept default: varies)
+echo w # Write changes
+) | sudo fdisk /dev/sda
+mkfs.ext4 /dev/sda1
+
+# Mount and install
+mount /dev/sda1 /mnt
+pacstrap base linux linux-firmware grub dhcpcd vim qemu-guest-agent
+genfstab -U /mnt >> /mnt/etc/fstab
+
+# Setup system in chroot
+arch-chroot /mnt "ln -sf /usr/share/zoneinfo/UTC /etc/localtime;
+				  echo en_US.UTF-8 >> /etc/locale.gen;
+				  locale-gen;
+				  echo LANG=en_US.UTF-8 > /etc/locale.conf;
+				  echo $HOSTNAME > /etc/hostname;
+				  printf \"127.0.0.1\tlocalhost\n::1\t\tlocalhost\n127.0.1.1\t$HOSTNAME.localdomain $HOSTNAME\" > /etc/hostname;
+				  systemctl enable dhcpcd qemu-guest-agent;
+				  mkinitcpio -P;
+				  echo root:$RPASS | chpasswd;
+				  grub-install /dev/sda;
+				  grub-mkconfig -o /boot/grub/grub.cfg"
+
+reboot

--
Gitblit v1.9.3