Need to be able to init on any distro.
The current supervisor.d configs are configured specifically for a particular supervisor version / installation. This decouples the configuration so we can use it on any distro.
This commit is contained in:
@@ -15,11 +15,19 @@ echo "Setting umask to ${UMASK}";
|
||||
umask ${UMASK}
|
||||
|
||||
|
||||
echo "Create the user XDG_RUNTIME_DIR"
|
||||
XDG_RUNTIME_DIR=/run/user/${PUID}
|
||||
mkdir -p ${XDG_RUNTIME_DIR}
|
||||
chown -R ${PUID}:${PGID} ${XDG_RUNTIME_DIR}
|
||||
export XDG_DATA_DIRS="${XDG_DATA_DIRS}:/var/lib/flatpak/exports/share:/home/${USER}/.local/share/flatpak/exports/share"
|
||||
|
||||
|
||||
# Setup home directory and permissions
|
||||
echo "Adding default home directory template"
|
||||
mkdir -p ${USER_HOME}
|
||||
chown -R ${PUID}:${PGID} /etc/home_directory_template
|
||||
rsync -aq /etc/home_directory_template/ ${USER_HOME}/
|
||||
chmod +x /usr/bin/start-desktop.sh
|
||||
|
||||
|
||||
# Set the root and user password
|
||||
|
||||
@@ -4,11 +4,11 @@ echo "**** Configure container dbus ****";
|
||||
if [[ "${HOST_DBUS}" == "true" ]]; then
|
||||
echo "Container configured to use the host dbus";
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/dbus.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/dbus.ini
|
||||
else
|
||||
echo "Container configured to run its own dbus";
|
||||
# Enable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor/conf.d/dbus.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/dbus.ini
|
||||
# Configure dbus to run as USER
|
||||
sed -i "/ <user>/c\ <user>${USER}</user>" /usr/share/dbus-1/system.conf
|
||||
# Remove old dbus session
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
# File Created: Friday, 12th January 2022 8:54:01 am
|
||||
# Author: Josh.5 (jsunnex@gmail.com)
|
||||
# -----
|
||||
# Last Modified: Friday, 14th January 2022 9:21:11 am
|
||||
# Modified By: Josh.5 (jsunnex@gmail.com)
|
||||
# Last Modified: Saturday, 22nd January 2022 8:20:34 pm
|
||||
# Modified By: Console and webGui login account (jsunnex@gmail.com)
|
||||
###
|
||||
|
||||
# Running udev only works in privileged container
|
||||
@@ -25,14 +25,16 @@ rm -rf "${tmp_mount}"
|
||||
if [[ "${is_privileged}" == "true" ]]; then
|
||||
echo "**** Configure container to run udev management ****";
|
||||
# Enable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor/conf.d/udev.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/udev.ini
|
||||
# Make startup script executable
|
||||
chmod +x /usr/bin/start-udev.sh
|
||||
# Configure udev permissions
|
||||
sed -i 's/MODE="0660"/MODE="0666"/' /lib/udev/rules.d/60-steam-input.rules
|
||||
if [[ -f /lib/udev/rules.d/60-steam-input.rules ]]; then
|
||||
sed -i 's/MODE="0660"/MODE="0666"/' /lib/udev/rules.d/60-steam-input.rules
|
||||
fi
|
||||
else
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/udev.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/udev.ini
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
|
||||
echo "**** Configure VNC audio ****"
|
||||
if [[ "${ENABLE_VNC_AUDIO}" == "true" ]]; then
|
||||
echo "Configure pulseaudio to use a socket to pipe audio to VNC"
|
||||
sed -i 's|^; default-server.*$|default-server = unix:/tmp/pulseaudio.socket|' /etc/pulse/client.conf
|
||||
sed -i 's|^load-module module-native-protocol-unix.*$|load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket auth-anonymous=1|' \
|
||||
/etc/pulse/default.pa
|
||||
chown -R ${USER} /etc/pulse
|
||||
|
||||
echo "Configure pulseaudio to pipe audio to a socket"
|
||||
sed -i 's|^; default-server.*$|default-server = unix:/tmp/pulseaudio.socket|' /etc/pulse/client.conf
|
||||
sed -i 's|^load-module module-native-protocol-unix.*$|load-module module-native-protocol-unix socket=/tmp/pulseaudio.socket auth-anonymous=1|' \
|
||||
/etc/pulse/default.pa
|
||||
chown -R ${USER} /etc/pulse
|
||||
|
||||
if [[ "${ENABLE_VNC_AUDIO}" == "true" ]]; then
|
||||
# Credits for this audio patch:
|
||||
# - https://github.com/novnc/noVNC/issues/302
|
||||
# - https://github.com/vexingcodes/dwarf-fortress-docker
|
||||
@@ -19,7 +20,7 @@ if [[ "${ENABLE_VNC_AUDIO}" == "true" ]]; then
|
||||
rm /opt/noVNC/audio.patch
|
||||
fi
|
||||
# Enable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor/conf.d/vnc-audio.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc-audio.ini
|
||||
|
||||
# Remove x11vnc from applications menu
|
||||
if ! grep -q 'Hidden=true' /usr/share/applications/x11vnc.desktop; then
|
||||
@@ -29,7 +30,7 @@ else
|
||||
echo "Disable audio stream"
|
||||
echo "Disable audio websock"
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/vnc-audio.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini
|
||||
fi
|
||||
|
||||
echo "DONE"
|
||||
|
||||
@@ -51,19 +51,24 @@ function configure_x_server {
|
||||
mkdir -p /tmp/.X11-unix
|
||||
fi
|
||||
|
||||
# Ensure X-windows session path is owned by root
|
||||
mkdir -p /tmp/.ICE-unix
|
||||
chown root:root /tmp/.ICE-unix/
|
||||
chmod 1777 /tmp/.ICE-unix/
|
||||
|
||||
# Check if this container is being run as a secondary instance
|
||||
if [ "${MODE}" == "p" ] | [ "${MODE}" == "primary" ]; then
|
||||
echo "Configure container as primary the X server"
|
||||
# Enable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor/conf.d/xorg.conf
|
||||
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
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/xorg.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
|
||||
else
|
||||
echo "Configure container as secondary and do not run an X server"
|
||||
# Disable supervisord script
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor/conf.d/xorg.conf
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/xorg.ini
|
||||
fi
|
||||
# Make startup script executable
|
||||
chmod +x /usr/bin/start-xorg.sh
|
||||
|
||||
Reference in New Issue
Block a user