From b47dc646c653d9334aa967e74c2061b8acb6777d Mon Sep 17 00:00:00 2001 From: ich777 Date: Fri, 15 Apr 2022 11:22:26 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9Escripts/start.sh=E2=80=9C=20=C3=A4nder?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/start.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 723395a..38f1531 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,18 +1,22 @@ #!/bin/bash -echo "---Checking if UID: ${UID} matches user---" +echo "---Ensuring UID: ${UID} matches user---" usermod -u ${UID} ${USER} -echo "---Checking if GID: ${GID} matches user---" +echo "---Ensuring GID: ${GID} matches user---" +groupmod -g ${GID} ${USER} > /dev/null 2>&1 ||: usermod -g ${GID} ${USER} echo "---Setting umask to ${UMASK}---" umask ${UMASK} echo "---Checking for optional scripts---" -if [ -f /opt/scripts/user.sh ]; then - echo "---Found optional script, executing---" - chmod +x /opt/scripts/user.sh - /opt/scripts/user.sh +cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||: +cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||: + +if [ -f /opt/scripts/start-user.sh ]; then + echo "---Found optional script, executing---" + chmod -f +x /opt/scripts/start-user.sh.sh ||: + /opt/scripts/start-user.sh || echo "---Optional Script has thrown an Error---" else - echo "---No optional script found, continuing---" + echo "---No optional script found, continuing---" fi if [ ! -d /tmp/xdg ]; then @@ -24,7 +28,7 @@ sed -i "/ /c\ ${USER}" /usr/share/dbus-1/system.conf echo "---Checking configuration for noVNC---" novnccheck -echo "---Starting...---" +echo "---Taking ownership of data...---" rm -R ${DATA_DIR}/.dbus/session-bus/* 2> /dev/null if [ ! -d /var/run/dbus ]; then mkdir -p /var/run/dbus @@ -41,6 +45,7 @@ chown -R ${UID}:${GID} /opt/gpodder chown -R ${UID}:${GID} ${DATA_DIR} chown ${UID}:${GID} /mnt/ +echo "---Starting...---" term_handler() { kill -SIGTERM "$killpid" wait "$killpid" -f 2>/dev/null