This commit is contained in:
2023-11-17 06:23:29 -08:00
parent 46cd17b8f6
commit fbbf147c5f
3 changed files with 59 additions and 61 deletions

View File

@@ -1,11 +1,11 @@
#!/bin/bash
echo "---Ensuring UID: ${UID} matches user---"
usermod -u ${UID} ${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 "---Ensuring UID: $UID matches user---"
usermod -u $UID $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---"
cp -f /opt/custom/user.sh /opt/scripts/start-user.sh > /dev/null 2>&1 ||:
@@ -20,9 +20,9 @@ else
fi
echo "---Taking ownership of data...---"
chown -R root:${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() {
@@ -32,10 +32,10 @@ term_handler() {
}
trap 'kill ${!}; term_handler' SIGTERM
su ${USER} -c "/opt/scripts/start-server.sh" &
su $USER -c "/opt/scripts/start-server.sh" &
killpid="$!"
while true
do
wait $killpid
exit 0;
done
done