#!/bin/sh

PUID=${PUID:-1000}
PGID=${PGID:-100}

groupmod -o -g "$PGID" public
usermod -o -u "$PUID" public

echo "**** Make sure the data folders exist ****"
[ ! -d /public ] && \
	mkdir -p /public

[ ! -e /app/ssl/ssl.crt ] && \
	cp -r /etc/nginx/ssl/ssl.* /app/ssl/

echo "**** Set Permissions ****" && \
chown -R "$PUID":"$PGID" /public
chown -R "$PUID":"$PGID" /fancyindex

echo "**** Setup complete, starting the server. ****"