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:
@@ -5,7 +5,7 @@
|
|||||||
# File Created: Saturday, 8th January 2022 2:34:23 pm
|
# File Created: Saturday, 8th January 2022 2:34:23 pm
|
||||||
# Author: Josh.5 (jsunnex@gmail.com)
|
# 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)
|
# Modified By: Console and webGui login account (jsunnex@gmail.com)
|
||||||
###
|
###
|
||||||
|
|
||||||
@@ -25,12 +25,12 @@ for ARG in ${@}; do
|
|||||||
*nvidia)
|
*nvidia)
|
||||||
nvidia="true";
|
nvidia="true";
|
||||||
;;
|
;;
|
||||||
*hostx)
|
|
||||||
hostx="true";
|
|
||||||
;;
|
|
||||||
*fb)
|
*fb)
|
||||||
framebuffer="true";
|
framebuffer="true";
|
||||||
;;
|
;;
|
||||||
|
*br0)
|
||||||
|
network="br0";
|
||||||
|
;;
|
||||||
stop)
|
stop)
|
||||||
script_mode="stop"
|
script_mode="stop"
|
||||||
;;
|
;;
|
||||||
@@ -57,25 +57,22 @@ if [[ "${primary}" == "true" ]]; then
|
|||||||
container_name="${container_name}-p"
|
container_name="${container_name}-p"
|
||||||
additional_docker_params="${additional_docker_params} -e MODE=primary"
|
additional_docker_params="${additional_docker_params} -e MODE=primary"
|
||||||
hostx="false"
|
hostx="false"
|
||||||
|
elif [[ "${framebuffer}" == "true" ]]; then
|
||||||
|
# TODO: Enable xvfb
|
||||||
|
container_name="${container_name}-fb"
|
||||||
|
additional_docker_params="${additional_docker_params} -e MODE=framebuffer"
|
||||||
else
|
else
|
||||||
container_name="${container_name}-s"
|
container_name="${container_name}-s"
|
||||||
additional_docker_params="${additional_docker_params} -e MODE=secondary"
|
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
|
fi
|
||||||
if [[ "${nvidia}" == "true" ]]; then
|
if [[ "${nvidia}" == "true" ]]; then
|
||||||
container_name="${container_name}-hw"
|
container_name="${container_name}-hw"
|
||||||
additional_docker_params="${additional_docker_params} --runtime=nvidia"
|
additional_docker_params="${additional_docker_params} --runtime=nvidia"
|
||||||
framebuffer="false"
|
|
||||||
fi
|
fi
|
||||||
if [[ "${framebuffer}" == "true" ]]; then
|
if [[ "${network}" == "br0" ]]; then
|
||||||
# TODO: Enable xvfb
|
additional_docker_params="${additional_docker_params} --network=br0 --ip='192.168.1.208'"
|
||||||
container_name="${container_name}-fb"
|
else
|
||||||
|
additional_docker_params="${additional_docker_params} --network=host"
|
||||||
fi
|
fi
|
||||||
if [[ -e /dev/dri ]]; then
|
if [[ -e /dev/dri ]]; then
|
||||||
additional_docker_params="${additional_docker_params} --device=/dev/dri"
|
additional_docker_params="${additional_docker_params} --device=/dev/dri"
|
||||||
@@ -108,8 +105,6 @@ sleep 1
|
|||||||
# Run
|
# Run
|
||||||
cmd="docker run -d --name='${container_name}' \
|
cmd="docker run -d --name='${container_name}' \
|
||||||
--privileged=true \
|
--privileged=true \
|
||||||
--network=host \
|
|
||||||
--ipc='host' \
|
|
||||||
-e PUID='99' \
|
-e PUID='99' \
|
||||||
-e PGID='100' \
|
-e PGID='100' \
|
||||||
-e UMASK='000' \
|
-e UMASK='000' \
|
||||||
|
|||||||
@@ -63,8 +63,10 @@ function configure_x_server {
|
|||||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xorg.ini
|
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/xorg.ini
|
||||||
elif [ "${MODE}" == "fb" ] | [ "${MODE}" == "framebuffer" ]; then
|
elif [ "${MODE}" == "fb" ] | [ "${MODE}" == "framebuffer" ]; then
|
||||||
echo "Configure container to use a virtual framebuffer as the X server"
|
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
|
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
|
fi
|
||||||
# Make startup script executable
|
# Make startup script executable
|
||||||
chmod +x /usr/bin/start-xorg.sh
|
chmod +x /usr/bin/start-xorg.sh
|
||||||
|
|||||||
13
overlay/etc/supervisor.d/xvfb.ini
Normal file
13
overlay/etc/supervisor.d/xvfb.ini
Normal 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
|
||||||
Reference in New Issue
Block a user