From afed1b36bc5fc8e331a569ba5a5a2fa0e4c71fe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsolt=20Alf=C3=B6ldi?= Date: Sat, 28 Feb 2026 16:04:02 +0100 Subject: [PATCH] envsubst hack qemu fix and more --- qemu.sh | 26 +++++++++++--------------- templates/user-data.tmpl | 7 ++++++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/qemu.sh b/qemu.sh index 1afccb3..f13d9bd 100644 --- a/qemu.sh +++ b/qemu.sh @@ -4,28 +4,24 @@ last_autoinstaller=$(ls -t1 autoinstall-2026* | head -n1) echo " ....... $last_autoinstaller" sleep 1 -# qemu-system-x86_64 \ -# -m 2048 \ -# -enable-kvm \ -# -drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk \ -# -device usb-ehci \ -# -device usb-storage,drive=usbdisk \ -# -bios /usr/share/ovmf/OVMF.fd - -_cdrom="" +_cdrom=() if [[ "$1" = "cdrom" ]]; then - _cdrom="-drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk - -device usb-ehci \ - -device usb-storage,drive=usbdisk \ - " + _cdrom=( + -drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk + -device usb-ehci,id=usb + -device usb-storage,drive=usbdisk,bus=usb.0,bootindex=1 + -bios /usr/share/ovmf/OVMF.fd + ) fi -# Create a virtual disk first +## Create a virtual disk first +## Uncomment 'create' if test-disk missing # qemu-img create -f qcow2 /tmp/test-disk.qcow2 20G # Boot the ISO as USB with the virtual disk as install target qemu-system-x86_64 \ -m 4096 \ -enable-kvm \ - -drive file=/tmp/test-disk.qcow2,format=qcow2 $_cdrom \ + -drive file=/tmp/test-disk.qcow2,format=qcow2 \ + "${_cdrom[@]}" \ -bios /usr/share/ovmf/OVMF.fd diff --git a/templates/user-data.tmpl b/templates/user-data.tmpl index 68d0d30..044ec0f 100644 --- a/templates/user-data.tmpl +++ b/templates/user-data.tmpl @@ -71,12 +71,17 @@ autoinstall: - path: /home/${TARGET_USER}/first_install.sh permissions: "0755" owner: ${TARGET_USER}:${TARGET_USER} + # | + # envsubst hack \ / + # ` content: | - if [[ $EUID -ne 0 ]]; then + if [[ "$${Q}EUID" -ne 0 ]]; then echo "This script must be run as root" exit 1 fi chown ${TARGET_USER}:${TARGET_USER} -R /home/${TARGET_USER}/nocloud/ + netplan generate || true + netplan apply || true bash -x /home/${TARGET_USER}/nocloud/post-install.sh main # - path: /etc/himmelblau/himmelblau.conf