envsubst hack
qemu fix and more
This commit is contained in:
26
qemu.sh
26
qemu.sh
@@ -4,28 +4,24 @@ last_autoinstaller=$(ls -t1 autoinstall-2026* | head -n1)
|
|||||||
echo " ....... $last_autoinstaller"
|
echo " ....... $last_autoinstaller"
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
# qemu-system-x86_64 \
|
_cdrom=()
|
||||||
# -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=""
|
|
||||||
if [[ "$1" = "cdrom" ]]; then
|
if [[ "$1" = "cdrom" ]]; then
|
||||||
_cdrom="-drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk
|
_cdrom=(
|
||||||
-device usb-ehci \
|
-drive file=${last_autoinstaller},format=raw,if=none,id=usbdisk
|
||||||
-device usb-storage,drive=usbdisk \
|
-device usb-ehci,id=usb
|
||||||
"
|
-device usb-storage,drive=usbdisk,bus=usb.0,bootindex=1
|
||||||
|
-bios /usr/share/ovmf/OVMF.fd
|
||||||
|
)
|
||||||
fi
|
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
|
# qemu-img create -f qcow2 /tmp/test-disk.qcow2 20G
|
||||||
|
|
||||||
# Boot the ISO as USB with the virtual disk as install target
|
# Boot the ISO as USB with the virtual disk as install target
|
||||||
qemu-system-x86_64 \
|
qemu-system-x86_64 \
|
||||||
-m 4096 \
|
-m 4096 \
|
||||||
-enable-kvm \
|
-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
|
-bios /usr/share/ovmf/OVMF.fd
|
||||||
|
|||||||
@@ -71,12 +71,17 @@ autoinstall:
|
|||||||
- path: /home/${TARGET_USER}/first_install.sh
|
- path: /home/${TARGET_USER}/first_install.sh
|
||||||
permissions: "0755"
|
permissions: "0755"
|
||||||
owner: ${TARGET_USER}:${TARGET_USER}
|
owner: ${TARGET_USER}:${TARGET_USER}
|
||||||
|
# |
|
||||||
|
# envsubst hack \ /
|
||||||
|
# `
|
||||||
content: |
|
content: |
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ "$${Q}EUID" -ne 0 ]]; then
|
||||||
echo "This script must be run as root"
|
echo "This script must be run as root"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
chown ${TARGET_USER}:${TARGET_USER} -R /home/${TARGET_USER}/nocloud/
|
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
|
bash -x /home/${TARGET_USER}/nocloud/post-install.sh main
|
||||||
|
|
||||||
# - path: /etc/himmelblau/himmelblau.conf
|
# - path: /etc/himmelblau/himmelblau.conf
|
||||||
|
|||||||
Reference in New Issue
Block a user