„scripts/start.sh“ ändern

This commit is contained in:
2022-04-18 13:38:45 +02:00
parent 72a74c5495
commit eb6adc1034

View File

@@ -1,24 +1,30 @@
#!/bin/bash #!/bin/bash
echo "---Checking if UID: ${UID} matches user---" echo "---Ensuring UID: ${UID} matches user---"
usermod -u ${UID} ${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} usermod -g ${GID} ${USER}
echo "---Setting umask to ${UMASK}---" echo "---Setting umask to ${UMASK}---"
umask ${UMASK} umask ${UMASK}
echo "---Checking for optional scripts---" echo "---Checking for optional scripts---"
if [ -f /opt/scripts/user.sh ]; then cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
echo "---Found optional script, executing---" cp -f /opt/scripts/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
chmod +x /opt/scripts/user.sh
/opt/scripts/user.sh 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 else
echo "---No optional script found, continuing---" echo "---No optional script found, continuing---"
fi fi
echo "---Starting...---" echo "---Taking ownership of data...---"
chown -R ${UID}:${GID} /opt/scripts chown -R root:${GID} /opt/scripts
chmod -R 750 /opt/scripts
chown -R ${UID}:${GID} ${DATA_DIR} chown -R ${UID}:${GID} ${DATA_DIR}
echo "---Starting...---"
term_handler() { term_handler() {
kill -SIGTERM "$killpid" kill -SIGTERM "$killpid"
wait "$killpid" -f 2>/dev/null wait "$killpid" -f 2>/dev/null