2023-01-18 07:39:23 +00:00
|
|
|
#!/command/with-contenv bash
|
|
|
|
|
|
|
|
# Change runtime user UID and GID
|
|
|
|
PUID="${PUID:-911}"
|
|
|
|
PUID="${PUID:-911}"
|
|
|
|
groupmod -o -g "$PGID" app
|
|
|
|
usermod -o -u "$PUID" app
|
|
|
|
|
|
|
|
# Reset permissions
|
|
|
|
chown -R app:app /run/app
|
|
|
|
chmod -R 0700 /run/app
|
|
|
|
chown -R app:app /config
|
|
|
|
chmod -R 0755 /config
|
|
|
|
chown -R root:app /app
|
|
|
|
chmod -R 0750 /app
|
|
|
|
chown -R app:app /app/common/static
|
|
|
|
chmod -R 0750 /app/common/static
|
|
|
|
chown -R app:app /app/static
|
|
|
|
chmod -R 0750 /app/static
|
|
|
|
find /app -type f ! -iname healthcheck.py -exec chmod 640 {} \;
|
|
|
|
chmod 0755 /app/healthcheck.py
|
|
|
|
|
2023-03-26 03:05:47 +00:00
|
|
|
# Optionally reset the download dir permissions
|
|
|
|
TUBESYNC_RESET_DOWNLOAD_DIR="${TUBESYNC_RESET_DOWNLOAD_DIR:-True}"
|
|
|
|
if [ "$TUBESYNC_RESET_DOWNLOAD_DIR" == "True" ]
|
|
|
|
then
|
|
|
|
echo "TUBESYNC_RESET_DOWNLOAD_DIR=True, Resetting /downloads directory permissions"
|
|
|
|
chown -R app:app /downloads
|
|
|
|
chmod -R 0755 /downloads
|
|
|
|
fi
|
|
|
|
|
2023-01-18 07:39:23 +00:00
|
|
|
# Run migrations
|
|
|
|
exec s6-setuidgid app \
|
|
|
|
/usr/bin/python3 /app/manage.py migrate
|