Skip to content

Commit

Permalink
fix: Console output (#268)
Browse files Browse the repository at this point in the history
* fix: Console output
  • Loading branch information
kroese authored Dec 25, 2023
1 parent 47fdeca commit e35d99e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ services:
container_name: qemu
image: qemux/qemu-docker:latest
environment:
DISPLAY: "vnc"
RAM_SIZE: "1G"
CPU_CORES: "1"
DISK_SIZE: "16G"
Expand All @@ -19,6 +18,5 @@ services:
- NET_ADMIN
ports:
- 2222:22
- 5900:5900
restart: on-failure
stop_grace_period: 1m
2 changes: 0 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,13 @@ services:
container_name: qemu
image: qemux/qemu-docker:latest
environment:
DISPLAY: "vnc"
BOOT: "https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/x86_64/alpine-standard-3.18.2-x86_64.iso"
devices:
- /dev/kvm
cap_add:
- NET_ADMIN
ports:
- 2222:22
- 5900:5900
restart: on-failure
```
Expand Down
20 changes: 6 additions & 14 deletions src/display.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,24 @@ set -Eeuo pipefail
# Docker environment variables

: ${GPU:='N'} # GPU passthrough
: ${DISPLAY:='none'} # Display type
: ${DISPLAY:='curses'} # Display type

case "${DISPLAY,,}" in
vnc)
if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then
DISPLAY_OPTS="-nographic -vga std -vnc :0"
else
DISPLAY_OPTS="-vga std -vnc :0"
fi
DISPLAY_OPTS="-nographic -vga std -vnc :0"
;;
*)
if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then
DISPLAY_OPTS="-nographic -display none"
else
DISPLAY_OPTS=""
fi
DISPLAY_OPTS="-nographic -display $DISPLAY"
;;
esac

if [[ "$GPU" != [Yy1]* ]] || [[ "$ARCH" != "amd64" ]]; then
return 0
fi

DISPLAY_OPTS="-display egl-headless,rendernode=/dev/dri/renderD128"
DISPLAY_OPTS="$DISPLAY_OPTS -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"

[ ! -d /dev/dri ] && mkdir -m 755 /dev/dri

if [ ! -c /dev/dri/card0 ]; then
Expand All @@ -44,7 +39,4 @@ fi
addPackage "xserver-xorg-video-intel" "Intel GPU drivers"
addPackage "qemu-system-modules-opengl" "OpenGL module"

DISPLAY_OPTS="$DISPLAY_OPTS -display egl-headless,rendernode=/dev/dri/renderD128"
DISPLAY_OPTS="$DISPLAY_OPTS -device virtio-vga,id=video0,max_outputs=1,bus=pcie.0,addr=0x1"

return 0

0 comments on commit e35d99e

Please sign in to comment.