#!/bin/bash IMAGE_NAME="Parch-Linux-x86_64-cloudimg-${build_version}.qcow2" DISK_SIZE="" PACKAGES=(cloud-init cloud-guest-utils gptfdisk) SERVICES=(cloud-init-main.service cloud-init-local.service cloud-init-network.service cloud-config.service cloud-final.service qemu-guest-agent.service) function pre() { cat <<'EOF' >"${MOUNT}/etc/systemd/network/80-dhcp.network" [Match] Name=en* eth* [Network] DHCP=yes EOF sed -Ei 's/^(GRUB_CMDLINE_LINUX_DEFAULT=.*)"$/\1 console=tty0 console=ttyS0,115200"/' "${MOUNT}/etc/default/grub" echo 'GRUB_TERMINAL="serial console"' >>"${MOUNT}/etc/default/grub" echo 'GRUB_SERIAL_COMMAND="serial --speed=115200"' >>"${MOUNT}/etc/default/grub" arch-chroot "${MOUNT}" /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg } function post() { qemu-img convert -c -f raw -O qcow2 "${1}" "${2}" rm "${1}" }