From adac2781067a2590120b08dae048fc26d463b0ba Mon Sep 17 00:00:00 2001 From: "Josh.5" Date: Sat, 17 Sep 2022 19:32:25 +1200 Subject: [PATCH] Add user to pulse group in setup_user.sh script --- Dockerfile | 3 - overlay/etc/cont-init.d/10-setup_user.sh | 4 +- overlay/etc/cont-init.d/70-configure_neko.sh | 21 ++++--- overlay/etc/cont-init.d/70-configure_vnc.sh | 58 +++++++++++--------- 4 files changed, 45 insertions(+), 41 deletions(-) diff --git a/Dockerfile b/Dockerfile index baa99cd..dba256e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -426,9 +426,6 @@ RUN \ && chown -R ${USER} \ ${USER_HOME} \ && echo "${USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers \ - && adduser ${USER} audio \ - && adduser ${USER} video \ - && adduser ${USER} pulse \ && \ echo diff --git a/overlay/etc/cont-init.d/10-setup_user.sh b/overlay/etc/cont-init.d/10-setup_user.sh index d7ed683..3541c2c 100644 --- a/overlay/etc/cont-init.d/10-setup_user.sh +++ b/overlay/etc/cont-init.d/10-setup_user.sh @@ -11,8 +11,8 @@ usermod -o -u "${PUID}" ${USER} groupmod -o -g "${PGID}" ${USER} -echo "Adding run user to video, input and audio groups" -usermod -a -G video,input,audio ${USER} +echo "Adding run user to video, audio, input and pulse groups" +usermod -a -G video,audio,input,pulse ${USER} echo "Setting umask to ${UMASK}"; diff --git a/overlay/etc/cont-init.d/70-configure_neko.sh b/overlay/etc/cont-init.d/70-configure_neko.sh index 07f88e4..ff667e7 100644 --- a/overlay/etc/cont-init.d/70-configure_neko.sh +++ b/overlay/etc/cont-init.d/70-configure_neko.sh @@ -1,18 +1,21 @@ echo "**** Configure Neko ****" - -if ([ ${WEB_UI_MODE} = "neko" ] && [ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then - echo "Enable Neko server" - sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/neko.ini - if [[ -z ${NEKO_NAT1TO1} ]]; then - export NEKO_NAT1TO1=$(ip route get 1 | awk '{print $(NF-2);exit}') - echo "Setting NEKO_NAT1TO1=${NEKO_NAT1TO1}" +if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then + if [ ${WEB_UI_MODE} = "neko" ]; then + echo "Enable Neko server" + sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/neko.ini + if [[ -z ${NEKO_NAT1TO1} ]]; then + export NEKO_NAT1TO1=$(ip route get 1 | awk '{print $(NF-2);exit}') + echo "Setting NEKO_NAT1TO1=${NEKO_NAT1TO1}" + else + echo "User provided setting NEKO_NAT1TO1=${NEKO_NAT1TO1}" + fi else - echo "User provided setting NEKO_NAT1TO1=${NEKO_NAT1TO1}" + echo "Disable Neko server" fi else - echo "Disable Neko server" + echo "Neko server not available when container is run in 'secondary' mode" fi echo "DONE" diff --git a/overlay/etc/cont-init.d/70-configure_vnc.sh b/overlay/etc/cont-init.d/70-configure_vnc.sh index b778476..40acd99 100644 --- a/overlay/etc/cont-init.d/70-configure_vnc.sh +++ b/overlay/etc/cont-init.d/70-configure_vnc.sh @@ -1,39 +1,43 @@ echo "**** Configure VNC ****" -if ([ ${WEB_UI_MODE} = "vnc" ] && [ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then - echo "Enable VNC server" - sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc.ini - 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 - # - https://github.com/calebj/noVNC - if [ -f /opt/noVNC/audio.patch ]; then - echo "Patching noVNC with audio websocket" +if ([ "${MODE}" != "s" ] && [ "${MODE}" != "secondary" ]); then + if [ ${WEB_UI_MODE} = "vnc" ]; then + echo "Enable VNC server" + sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc.ini + 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 + # - https://github.com/calebj/noVNC + if [ -f /opt/noVNC/audio.patch ]; then + echo "Patching noVNC with audio websocket" + # Enable supervisord script + sed -i "s|32123|${PORT_AUDIO_WEBSOCKET}|" /opt/noVNC/audio.patch + # Apply patch + pushd /opt/noVNC/ &> /dev/null + patch -p1 --input=/opt/noVNC/audio.patch --batch --quiet + popd &> /dev/null + rm /opt/noVNC/audio.patch + fi # Enable supervisord script - sed -i "s|32123|${PORT_AUDIO_WEBSOCKET}|" /opt/noVNC/audio.patch - # Apply patch - pushd /opt/noVNC/ &> /dev/null - patch -p1 --input=/opt/noVNC/audio.patch --batch --quiet - popd &> /dev/null - rm /opt/noVNC/audio.patch - fi - # Enable supervisord script - sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/vnc-audio.ini + 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 - echo 'Hidden=true' >> /usr/share/applications/x11vnc.desktop + # Remove x11vnc from applications menu + if ! grep -q 'Hidden=true' /usr/share/applications/x11vnc.desktop; then + echo 'Hidden=true' >> /usr/share/applications/x11vnc.desktop + fi + else + echo "Disable audio stream" + echo "Disable audio websock" + # Disable supervisord script + sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini fi else - echo "Disable audio stream" - echo "Disable audio websock" - # Disable supervisord script - sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/vnc-audio.ini + echo "Disable VNC server" fi else - echo "Disable VNC server" + echo "VNC server not available when container is run in 'secondary' mode" fi echo "DONE"