This repository has been archived on 2022-04-15. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2020-05-14 14:36:10 +02:00

45 lines
1.1 KiB
Bash

#!/bin/bash
echo "---Checking if UID: ${UID} matches user---"
usermod -u ${UID} ${USER}
echo "---Checking if GID: ${GID} matches user---"
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
else
echo "---No optional script found, continuing---"
fi
echo "---Starting...---"
chown -R ${UID}:${GID} /opt/scripts
if [ ! -d /mnt/downloads ]; then
mkdir -p /mnt/downloads
fi
if [ ! -d "${DATA_DIR}/.config/Deezloader Remix" ]; then
mkdir -p "${DATA_DIR}/.config/Deezloader Remix"
fi
if [ ! -f "${DATA_DIR}/.config/Deezloader Remix/config.json" ]; then
cp /tmp/config.json "${DATA_DIR}/.config/Deezloader Remix/config.json"
fi
chown -R ${UID}:${GID} /mnt/downloads
chown -R ${UID}:${GID} ${DATA_DIR}
term_handler() {
kill -SIGTERM "$(pidof node)"
tail --pid="$(pidof node)" -f 2>/dev/null
exit 143;
}
trap 'kill ${!}; term_handler' SIGTERM
su ${USER} -c "/opt/scripts/start-server.sh" &
killpid="$!"
while true
do
wait $killpid
exit 0;
done