Files
family-planner/docker-entrypoint.sh

24 lines
630 B
Bash
Raw Normal View History

#!/bin/sh
set -e
# Resolve PUID/PGID (Unraid default: nobody=99, users=100)
PUID=${PUID:-99}
PGID=${PGID:-100}
echo "[entrypoint] Starting Family Planner (PUID=${PUID}, PGID=${PGID})"
# Create the app user/group if they don't already exist at the requested IDs
if ! getent group appgroup > /dev/null 2>&1; then
addgroup -g "${PGID}" appgroup
fi
if ! getent passwd appuser > /dev/null 2>&1; then
adduser -D -u "${PUID}" -G appgroup appuser
fi
# Ensure /data is owned by the app user so SQLite can write
mkdir -p /data
chown -R "${PUID}:${PGID}" /data
# Drop privileges and exec the CMD
exec su-exec "${PUID}:${PGID}" "$@"