mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-29 01:21:02 +02:00
Merge pull request #2808 from flatcar/chewi/qemu-script-paths
build_library: Fix path handling in QEMU launcher script
This commit is contained in:
commit
8bc40c57c3
@ -260,9 +260,9 @@ fi
|
|||||||
if [ -n "${VM_IMAGE}" ]; then
|
if [ -n "${VM_IMAGE}" ]; then
|
||||||
case "${VM_BOARD}" in
|
case "${VM_BOARD}" in
|
||||||
amd64-usr)
|
amd64-usr)
|
||||||
set -- -drive if=virtio,file="${SCRIPT_DIR}/${VM_IMAGE}" "$@" ;;
|
set -- -drive if=virtio,file="${VM_IMAGE}" "$@" ;;
|
||||||
arm64-usr)
|
arm64-usr)
|
||||||
set -- -drive if=none,id=blk,file="${SCRIPT_DIR}/${VM_IMAGE}" \
|
set -- -drive if=none,id=blk,file="${VM_IMAGE}" \
|
||||||
-device virtio-blk-device,drive=blk "$@"
|
-device virtio-blk-device,drive=blk "$@"
|
||||||
;;
|
;;
|
||||||
*) die "Unsupported arch" ;;
|
*) die "Unsupported arch" ;;
|
||||||
@ -270,11 +270,11 @@ if [ -n "${VM_IMAGE}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${VM_KERNEL}" ]; then
|
if [ -n "${VM_KERNEL}" ]; then
|
||||||
set -- -kernel "${SCRIPT_DIR}/${VM_KERNEL}" "$@"
|
set -- -kernel "${VM_KERNEL}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${VM_INITRD}" ]; then
|
if [ -n "${VM_INITRD}" ]; then
|
||||||
set -- -initrd "${SCRIPT_DIR}/${VM_INITRD}" "$@"
|
set -- -initrd "${VM_INITRD}" "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${VM_UUID}" ]; then
|
if [ -n "${VM_UUID}" ]; then
|
||||||
@ -283,13 +283,13 @@ fi
|
|||||||
|
|
||||||
if [ -n "${VM_CDROM}" ]; then
|
if [ -n "${VM_CDROM}" ]; then
|
||||||
set -- -boot order=d \
|
set -- -boot order=d \
|
||||||
-drive file="${SCRIPT_DIR}/${VM_CDROM}",media=cdrom,format=raw "$@"
|
-drive file="${VM_CDROM}",media=cdrom,format=raw "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${VM_PFLASH_RO}" ] && [ -n "${VM_PFLASH_RW}" ]; then
|
if [ -n "${VM_PFLASH_RO}" ] && [ -n "${VM_PFLASH_RW}" ]; then
|
||||||
set -- \
|
set -- \
|
||||||
-drive if=pflash,unit=0,file="${SCRIPT_DIR}/${VM_PFLASH_RO}",format=qcow2,readonly=on \
|
-drive if=pflash,unit=0,file="${VM_PFLASH_RO}",format=qcow2,readonly=on \
|
||||||
-drive if=pflash,unit=1,file="${SCRIPT_DIR}/${VM_PFLASH_RW}",format=qcow2 "$@"
|
-drive if=pflash,unit=1,file="${VM_PFLASH_RW}",format=qcow2 "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "${IGNITION_CONFIG_FILE}" ]; then
|
if [ -n "${IGNITION_CONFIG_FILE}" ]; then
|
||||||
|
@ -821,7 +821,7 @@ _write_qemu_conf() {
|
|||||||
local dst_name=$(basename "$VM_DST_IMG")
|
local dst_name=$(basename "$VM_DST_IMG")
|
||||||
|
|
||||||
_write_qemu_common "${script}"
|
_write_qemu_common "${script}"
|
||||||
sed -e "s%^VM_IMAGE=.*%VM_IMAGE='${dst_name}'%" -i "${script}"
|
sed -e "s%^VM_IMAGE=.*%VM_IMAGE=\"\${SCRIPT_DIR}/${dst_name}\"%" -i "${script}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_write_qemu_uefi_conf() {
|
_write_qemu_uefi_conf() {
|
||||||
@ -842,8 +842,8 @@ _write_qemu_uefi_conf() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sed -e "s%^VM_PFLASH_RO=.*%VM_PFLASH_RO='${flash_ro}'%" \
|
sed -e "s%^VM_PFLASH_RO=.*%VM_PFLASH_RO=\"\${SCRIPT_DIR}/${flash_ro}\"%" \
|
||||||
-e "s%^VM_PFLASH_RW=.*%VM_PFLASH_RW='${flash_rw}'%" -i "${script}"
|
-e "s%^VM_PFLASH_RW=.*%VM_PFLASH_RW=\"\${SCRIPT_DIR}/${flash_rw}\"%" -i "${script}"
|
||||||
VM_GENERATED_FILES+=( "$(_dst_dir)/${flash_ro}" "$(_dst_dir)/${flash_rw}" )
|
VM_GENERATED_FILES+=( "$(_dst_dir)/${flash_ro}" "$(_dst_dir)/${flash_rw}" )
|
||||||
|
|
||||||
# We now only support building qemu_uefi and generate the
|
# We now only support building qemu_uefi and generate the
|
||||||
@ -899,8 +899,8 @@ _write_pxe_conf() {
|
|||||||
local dst_name=$(basename "$VM_DST_IMG")
|
local dst_name=$(basename "$VM_DST_IMG")
|
||||||
|
|
||||||
_write_qemu_common "${script}"
|
_write_qemu_common "${script}"
|
||||||
sed -e "s%^VM_KERNEL=.*%VM_KERNEL='${vmlinuz_name}'%" \
|
sed -e "s%^VM_KERNEL=.*%VM_KERNEL=\"\${SCRIPT_DIR}/${vmlinuz_name}\"%" \
|
||||||
-e "s%^VM_INITRD=.*%VM_INITRD='${dst_name}'%" -i "${script}"
|
-e "s%^VM_INITRD=.*%VM_INITRD=\"\${SCRIPT_DIR}/${dst_name}\"%" -i "${script}"
|
||||||
|
|
||||||
cat >>"${VM_README}" <<EOF
|
cat >>"${VM_README}" <<EOF
|
||||||
|
|
||||||
@ -925,7 +925,7 @@ _write_iso_conf() {
|
|||||||
local script="$(_dst_dir)/$(_dst_name ".sh")"
|
local script="$(_dst_dir)/$(_dst_name ".sh")"
|
||||||
local dst_name=$(basename "$VM_DST_IMG")
|
local dst_name=$(basename "$VM_DST_IMG")
|
||||||
_write_qemu_common "${script}"
|
_write_qemu_common "${script}"
|
||||||
sed -e "s%^VM_CDROM=.*%VM_CDROM='${dst_name}'%" -i "${script}"
|
sed -e "s%^VM_CDROM=.*%VM_CDROM=\"\${SCRIPT_DIR}/${dst_name}\"%" -i "${script}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate the vmware config file
|
# Generate the vmware config file
|
||||||
|
1
changelog/bugfixes/2025-04-07-qemu-script-paths.md
Normal file
1
changelog/bugfixes/2025-04-07-qemu-script-paths.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
- Fixed path handling in the QEMU .sh launcher scripts. Given paths now are relative to the current directory and absolute paths work as you would expect.
|
Loading…
x
Reference in New Issue
Block a user