summaryrefslogtreecommitdiffstats
path: root/setup-arch-vm
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2014-01-21 00:28:40 +0100
committerFlorian Pritz <bluewind@xinu.at>2014-01-21 00:28:40 +0100
commit3271a8db0be8e284f9f7a348d922e2baac0b14ee (patch)
treeef5226ce6bad4e8477f1ecb5c4c2a7aefc4a0f4d /setup-arch-vm
parent03812eb7db9fc3418deacdae90cedaa87fd6983c (diff)
downloadbin-3271a8db0be8e284f9f7a348d922e2baac0b14ee.tar.gz
bin-3271a8db0be8e284f9f7a348d922e2baac0b14ee.tar.xz
setup-arch-vm: improve to allow fully automatic operation; create a full
disk partition Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'setup-arch-vm')
-rw-r--r--setup-arch-vm24
1 files changed, 17 insertions, 7 deletions
diff --git a/setup-arch-vm b/setup-arch-vm
index eb8d949..0c0a275 100644
--- a/setup-arch-vm
+++ b/setup-arch-vm
@@ -3,9 +3,21 @@
set -e
newuser="flo"
+disk=/dev/vda
-mkfs.ext4 /dev/vda
-mount /dev/vda /mnt
+die() {
+ echo "$@"
+ exit 1
+}
+
+grep -qE '^flags\s+: .* hypervisor( |$)' /proc/cpuinfo || die "Not running in hypervisor. aborting automatic setup"
+
+dhcpcd eth0
+
+parted -s -- $disk mklabel msdos mkpart primary 1 -0
+
+mkfs.ext4 ${disk}1
+mount ${disk}1 /mnt
cat <<EOF >/etc/pacman.d/mirrorlist
Server = http://mirror.server-speed.net/\$repo/os/\$arch
EOF
@@ -32,7 +44,7 @@ TIMEOUT 50
LABEL arch
MENU LABEL Arch Linux
LINUX ../vmlinuz-linux
- APPEND root=/dev/vda ro logo.nologo elevator=deadline console=tty0 console=ttyS0
+ APPEND root=${disk}1 ro logo.nologo elevator=deadline console=tty0 console=ttyS0 nomodeset
INITRD ../initramfs-linux.img
EOF
@@ -41,9 +53,7 @@ blacklist cirrus
EOF
arch-chroot /mnt mkinitcpio -p linux
-# expected error: /dev/vda - is a block device. Aborting set_active!
-# TODO: create partitions and remove the || true
-arch-chroot /mnt syslinux-install_update -aim || true
+arch-chroot /mnt syslinux-install_update -aim
arch-chroot /mnt useradd -m -g users -G wheel $newuser
mkdir /mnt/root/.ssh
touch /mnt/root/.ssh/authorized_keys
@@ -63,4 +73,4 @@ arch-chroot /mnt passwd -d $newuser
arch-chroot /mnt systemctl enable sshd multi-user.target haveged dhcpcd.service
sync
-systemctl poweroff
+systemctl reboot