envsubst hack

qemu fix
and more
This commit is contained in:
Zsolt Alföldi
2026-02-28 16:04:02 +01:00
parent f35fc00243
commit afed1b36bc
2 changed files with 17 additions and 16 deletions

26
qemu.sh
View File

@@ -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

View File

@@ -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