Launch Xorg server direct from supervisor rather than a script

- Remove launcher for X11 and just call it from
- Improvements to the '/tmp/.X11-unix' directory
    - Move lockfile clearing to init script rather than launcher
    - Configure the 'XDG_RUNTIME_DIR' to something that is easily shared between containers
- Ensure all logs in home directory are readable
- Log Xorg service in home directory so they are more easily accessable to users
This commit is contained in:
Josh.5
2022-10-02 11:33:15 +00:00
committed by Josh Sunnex
parent cfd7bbda0e
commit 7614e503a7
4 changed files with 21 additions and 39 deletions

View File

@@ -31,7 +31,9 @@ echo "Setting umask to ${UMASK}";
umask ${UMASK}
export XDG_RUNTIME_DIR=/run/user/${PUID}
# Configure the 'XDG_RUNTIME_DIR' to something that is easily shared between containers
export XDG_RUNTIME_DIR=/tmp/.X11-unix/run
# export XDG_RUNTIME_DIR=/run/user/${PUID}
echo "Create the user XDG_RUNTIME_DIR path '${XDG_RUNTIME_DIR}'"
mkdir -p ${XDG_RUNTIME_DIR}
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}
@@ -46,6 +48,12 @@ rsync -aq --ignore-existing /etc/home_directory_template/ ${USER_HOME}/
chmod +x /usr/bin/start-desktop.sh
# Setup services log path
echo "Setting ownership of all log files in '${USER_HOME}/.cache/log'"
mkdir -p "${USER_HOME}/.cache/log"
chown -R ${PUID}:${PGID} "${USER_HOME}/.cache/log"
# Set the root and user password
echo "Setting root password"
echo "root:${USER_PASSWORD}" | chpasswd

View File

@@ -47,8 +47,14 @@ function configure_x_server {
fi
# Ensure the X socket path exists
if [ ! -d /tmp/.X11-unix ]; then
mkdir -p /tmp/.X11-unix
mkdir -p /tmp/.X11-unix
# Clear out old lock files
display_file=/tmp/.X11-unix/X${DISPLAY#:}
if [ -S ${display_file} ]; then
echo "Removing ${display_file} before starting"
rm -f /tmp/.X${DISPLAY#:}-lock
rm ${display_file}
fi
# Ensure X-windows session path is owned by root
@@ -68,8 +74,6 @@ function configure_x_server {
# 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
}
if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then

View File

@@ -4,12 +4,12 @@ priority=20
autostart=false
autorestart=true
user=root
command=/usr/bin/start-xorg.sh
environment=DISPLAY="%(ENV_DISPLAY)s",DISPLAY_DPI="%(ENV_DISPLAY_DPI)s"
command=/usr/bin/Xorg -ac -noreset -novtswitch -sharevts -dpi "%(ENV_DISPLAY_DPI)s" +extension "GLX" +extension "RANDR" +extension "RENDER" vt7 "%(ENV_DISPLAY)s"
environment=DISPLAY="%(ENV_DISPLAY)s",DISPLAY_DPI="%(ENV_DISPLAY_DPI)s",XDG_RUNTIME_DIR="%(ENV_XDG_RUNTIME_DIR)s"
stopsignal=INT
#stdout_logfile=/var/log/supervisor/xorg.log
stdout_logfile=/home/%(ENV_USER)s/.cache/log/xorg.log
stdout_logfile_maxbytes=10MB
stdout_logfile_backups=7
#stderr_logfile=/var/log/supervisor/xorg.err.log
stderr_logfile=/home/%(ENV_USER)s/.cache/log/xorg.err.log
stderr_logfile_maxbytes=10MB
stderr_logfile_backups=7