Add control for UID and GID

This commit is contained in:
2024-01-23 18:44:05 -06:00
parent 17107bd7bb
commit 7b1cf05fe8
3 changed files with 29 additions and 2 deletions

View File

@@ -4,6 +4,17 @@ source ContainerTools
SNAME=${0##*/}
WORKDIR="/app"
# Set user and group IDs
if [ -n "$PUID" ]; then
log "Setting User ID for nginx to $PUID"
usermod -o -u "$PUID" nginx
fi
if [ -n "$PGID" ]; then
log "Setting Group ID for nginx to $PGID"
groupmod -o -g "$PGID" nginx
fi
# If DBHOST value is present, pause boot until target container is up.
if [ -n "$DBHOST" ]; then
log "Waiting for SQL at $DBHOST:${DBPORT:=3306}"
@@ -32,6 +43,7 @@ if [ ! -d "/config/storage" ]; then
cat $WORKDIR/.storage.tmpl | while read line; do
mkdir -p "/config/${line}"
done
ln -s /config/logs/panel $WORKDIR/storage/logs
fi
# Check for persistent Nginx logging directory, create file path if not present.
@@ -46,6 +58,12 @@ if [ ! -d "/config/logs/php" ]; then
mkdir -p "/config/logs/php"
fi
# Check for persistent Panel logging directory, create file path if not present.
if [ ! -d "/config/logs/panel" ]; then
log "Creating PHP log directory."
mkdir -p "/config/logs/panel"
fi
# Check for config file, create template if not present.
if [ ! -e /config/pterodactyl.conf ]; then
log "Config file does not exist, creating template"
@@ -79,4 +97,9 @@ else
log "HTTP Nginx config file is already in place"
fi
fi
# Setting permissions for /config
log "Making sure permission for config folder are correct"
chown -R nginx:nginx /config
log "Initialization complete"