From c4905ecf00ccbc9ec0b5de55d357c6f8eaf13f47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Molinero=20Fern=C3=A1ndez?= Date: Mon, 2 Aug 2021 21:09:46 +0200 Subject: [PATCH] Renamed variables "QEMU_" to "QEMU_VM_" to avoid conflict with environment variables supported by QEMU --- Dockerfile.m4 | 20 ++++++++++---------- README.md | 20 ++++++++++---------- run.sh | 2 +- scripts/bin/container-foreground-cmd | 2 +- scripts/service/qemu/run | 12 ++++++------ 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Dockerfile.m4 b/Dockerfile.m4 index 2aebbfa..5c13240 100644 --- a/Dockerfile.m4 +++ b/Dockerfile.m4 @@ -60,16 +60,16 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && rm -rf /var/lib/apt/lists/* # Environment -ENV QEMU_CPU=2 -ENV QEMU_RAM=1024M -ENV QEMU_DISK_SIZE=16G -ENV QEMU_DISK_FORMAT=qcow2 -ENV QEMU_KEYBOARD=en-us -ENV QEMU_NET_DEVICE=e1000 -ENV QEMU_NET_OPTIONS=hostfwd=tcp::13389-:3389,hostfwd=tcp::15900-:5900 -ENV QEMU_BOOT_ORDER=cd -ENV QEMU_BOOT_MENU=off -ENV QEMU_KVM=false +ENV QEMU_VM_CPU=2 +ENV QEMU_VM_RAM=1024M +ENV QEMU_VM_DISK_SIZE=16G +ENV QEMU_VM_DISK_FORMAT=qcow2 +ENV QEMU_VM_KEYBOARD=en-us +ENV QEMU_VM_NET_DEVICE=e1000 +ENV QEMU_VM_NET_OPTIONS=hostfwd=tcp::13389-:3389,hostfwd=tcp::15900-:5900 +ENV QEMU_VM_BOOT_ORDER=cd +ENV QEMU_VM_BOOT_MENU=off +ENV QEMU_VM_KVM=false # Create some directories for QEMU RUN mkdir -p /var/lib/qemu/iso/ /var/lib/qemu/images/ diff --git a/README.md b/README.md index aadba20..aab1016 100644 --- a/README.md +++ b/README.md @@ -8,37 +8,37 @@ docker run --detach \ --name qemu-reactos \ --restart on-failure:3 \ --publish 127.0.0.1:6080:6080/tcp \ - --privileged --env QEMU_KVM=true \ + --privileged --env QEMU_VM_KVM=true \ docker.io/hectormolinero/qemu-reactos:latest ``` > The instance will be available through a web browser from: http://localhost:6080/vnc.html ## Environment variables -#### `QEMU_CPU` +#### `QEMU_VM_CPU` Number of cores the VM is permitted to use (`2` by default). -#### `QEMU_RAM` +#### `QEMU_VM_RAM` Amount of memory the VM is permitted to use (`1024M` by default). -#### `QEMU_DISK_SIZE` +#### `QEMU_VM_DISK_SIZE` VM disk size (`16G` by default). -#### `QEMU_DISK_FORMAT` +#### `QEMU_VM_DISK_FORMAT` VM disk format (`qcow2` by default). -#### `QEMU_KEYBOARD` +#### `QEMU_VM_KEYBOARD` VM keyboard layout (`en-us` by default). -#### `QEMU_NET_DEVICE` +#### `QEMU_VM_NET_DEVICE` VM network device (`e1000` by default). -#### `QEMU_BOOT_ORDER` +#### `QEMU_VM_BOOT_ORDER` VM boot order (`cd` by default). -#### `QEMU_BOOT_MENU` +#### `QEMU_VM_BOOT_MENU` VM boot menu (`off` by default). -#### `QEMU_KVM` +#### `QEMU_VM_KVM` Start QEMU in KVM mode (`false` by default). > The `--privileged` option is required to use KVM in the container. diff --git a/run.sh b/run.sh index 600701b..c164d4e 100755 --- a/run.sh +++ b/run.sh @@ -40,7 +40,7 @@ printf -- '%s\n' "Creating \"${CONTAINER_NAME:?}\" container..." --publish '127.0.0.1:5900:5900/tcp' \ --publish '127.0.0.1:6080:6080/tcp' \ --publish '127.0.0.1:15900:15900/tcp' \ - --privileged --env QEMU_KVM=true \ + --privileged --env QEMU_VM_KVM=true \ "${IMAGE_NAME:?}" "$@" >/dev/null printf -- '%s\n\n' 'Done!' diff --git a/scripts/bin/container-foreground-cmd b/scripts/bin/container-foreground-cmd index 9ab9051..e74504a 100755 --- a/scripts/bin/container-foreground-cmd +++ b/scripts/bin/container-foreground-cmd @@ -4,7 +4,7 @@ set -eu # Create ReactOS disk if [ ! -f /var/lib/qemu/images/reactos.img ]; then - qemu-img create -f "${QEMU_DISK_FORMAT:?}" /var/lib/qemu/images/reactos.img "${QEMU_DISK_SIZE:?}" + qemu-img create -f "${QEMU_VM_DISK_FORMAT:?}" /var/lib/qemu/images/reactos.img "${QEMU_VM_DISK_SIZE:?}" fi # Start all services diff --git a/scripts/service/qemu/run b/scripts/service/qemu/run index 6f11adb..ed460d8 100755 --- a/scripts/service/qemu/run +++ b/scripts/service/qemu/run @@ -3,15 +3,15 @@ set -eu QEMU=$(command -v qemu-system-x86_64) -QEMU_ARGS="${QEMU_ARGS-} -smp ${QEMU_CPU:?} -m ${QEMU_RAM:?}" +QEMU_ARGS="${QEMU_ARGS-} -smp ${QEMU_VM_CPU:?} -m ${QEMU_VM_RAM:?}" QEMU_ARGS="${QEMU_ARGS-} -vga std -display vnc=:0" -QEMU_ARGS="${QEMU_ARGS-} -drive file=/var/lib/qemu/images/reactos.img,index=0,media=disk,format=${QEMU_DISK_FORMAT:?}" +QEMU_ARGS="${QEMU_ARGS-} -drive file=/var/lib/qemu/images/reactos.img,index=0,media=disk,format=${QEMU_VM_DISK_FORMAT:?}" QEMU_ARGS="${QEMU_ARGS-} -drive file=/var/lib/qemu/iso/reactos.iso,index=2,media=cdrom,format=raw" -QEMU_ARGS="${QEMU_ARGS-} -boot order=${QEMU_BOOT_ORDER:?},menu=${QEMU_BOOT_MENU:?},splash-time=5000" -QEMU_ARGS="${QEMU_ARGS-} -netdev user,id=n0,${QEMU_NET_OPTIONS:?} -device ${QEMU_NET_DEVICE:?},netdev=n0" +QEMU_ARGS="${QEMU_ARGS-} -boot order=${QEMU_VM_BOOT_ORDER:?},menu=${QEMU_VM_BOOT_MENU:?},splash-time=5000" +QEMU_ARGS="${QEMU_ARGS-} -netdev user,id=n0,${QEMU_VM_NET_OPTIONS:?} -device ${QEMU_VM_NET_DEVICE:?},netdev=n0" QEMU_ARGS="${QEMU_ARGS-} -usb -device usb-tablet" -QEMU_ARGS="${QEMU_ARGS-} -k ${QEMU_KEYBOARD:?}" -if [ "${QEMU_KVM:?}" = true ]; then QEMU_ARGS="${QEMU_ARGS-} -enable-kvm"; fi +QEMU_ARGS="${QEMU_ARGS-} -k ${QEMU_VM_KEYBOARD:?}" +if [ "${QEMU_VM_KVM:?}" = true ]; then QEMU_ARGS="${QEMU_ARGS-} -enable-kvm"; fi cd /var/lib/qemu/ exec 2>&1