Add support for running a container using only a XvFB framebuffer for the X server

As requested by a user, this gives the option to run a headless steam for the purpose of downloading games and not for playing them.
This commit is contained in:
Josh.5
2022-02-08 08:03:56 +13:00
parent 73a4af0f5c
commit 168c46ae72
3 changed files with 28 additions and 18 deletions

View File

@@ -5,7 +5,7 @@
# File Created: Saturday, 8th January 2022 2:34:23 pm
# Author: Josh.5 (jsunnex@gmail.com)
# -----
# Last Modified: Wednesday, 26th January 2022 3:55:24 pm
# Last Modified: Tuesday, 8th February 2022 8:00:29 am
# Modified By: Console and webGui login account (jsunnex@gmail.com)
###
@@ -25,12 +25,12 @@ for ARG in ${@}; do
*nvidia)
nvidia="true";
;;
*hostx)
hostx="true";
;;
*fb)
framebuffer="true";
;;
*br0)
network="br0";
;;
stop)
script_mode="stop"
;;
@@ -57,25 +57,22 @@ if [[ "${primary}" == "true" ]]; then
container_name="${container_name}-p"
additional_docker_params="${additional_docker_params} -e MODE=primary"
hostx="false"
elif [[ "${framebuffer}" == "true" ]]; then
# TODO: Enable xvfb
container_name="${container_name}-fb"
additional_docker_params="${additional_docker_params} -e MODE=framebuffer"
else
container_name="${container_name}-s"
additional_docker_params="${additional_docker_params} -e MODE=secondary"
framebuffer="false"
fi
if [[ "${hostx}" == "true" ]]; then
container_name="${container_name}-hx"
additional_docker_params="${additional_docker_params} -e MODE=secondary"
nvidia="false"
framebuffer="false"
fi
if [[ "${nvidia}" == "true" ]]; then
container_name="${container_name}-hw"
additional_docker_params="${additional_docker_params} --runtime=nvidia"
framebuffer="false"
fi
if [[ "${framebuffer}" == "true" ]]; then
# TODO: Enable xvfb
container_name="${container_name}-fb"
if [[ "${network}" == "br0" ]]; then
additional_docker_params="${additional_docker_params} --network=br0 --ip='192.168.1.208'"
else
additional_docker_params="${additional_docker_params} --network=host"
fi
if [[ -e /dev/dri ]]; then
additional_docker_params="${additional_docker_params} --device=/dev/dri"
@@ -108,8 +105,6 @@ sleep 1
# Run
cmd="docker run -d --name='${container_name}' \
--privileged=true \
--network=host \
--ipc='host' \
-e PUID='99' \
-e PGID='100' \
-e UMASK='000' \

View File

@@ -63,8 +63,10 @@ function configure_x_server {
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xorg.ini
elif [ "${MODE}" == "fb" ] | [ "${MODE}" == "framebuffer" ]; then
echo "Configure container to use a virtual framebuffer as the X server"
# Disable supervisord script
# Disable xorg supervisord script
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
# Enable xvfb supervisord script
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xvfb.ini
fi
# Make startup script executable
chmod +x /usr/bin/start-xorg.sh

View File

@@ -0,0 +1,13 @@
[program:xvfb]
autostart=false
autorestart=true
priority=20
user=root
command=/usr/bin/Xvfb %(ENV_DISPLAY)s -screen 0 "%(ENV_DISPLAY_SIZEW)sx%(ENV_DISPLAY_SIZEH)sx24"
environment=DISPLAY="%(ENV_DISPLAY)s"
stopsignal=QUIT
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=7
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=7