mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 18:54:58 +00:00
22 lines
617 B
Bash
22 lines
617 B
Bash
#!/bin/bash
|
|
|
|
# Set up user details
|
|
export PUID=${PUID:-1000}
|
|
export PGID=${PGID:-1000}
|
|
|
|
# Create group if it doesn't exist
|
|
if ! getent group "$PGID" >/dev/null 2>&1; then
|
|
groupadd -g "$PGID" dispatch
|
|
fi
|
|
# Create user if it doesn't exist
|
|
if ! getent passwd $PUID > /dev/null 2>&1; then
|
|
useradd -u $PUID -g $PGID -m $POSTGRES_USER
|
|
else
|
|
existing_user=$(getent passwd $PUID | cut -d: -f1)
|
|
if [ "$existing_user" != "$POSTGRES_USER" ]; then
|
|
usermod -l $POSTGRES_USER -g $PGID "$existing_user"
|
|
fi
|
|
fi
|
|
|
|
# Run nginx as specified user
|
|
sed -i 's/user www-data;/user dispatch;/g' /etc/nginx/nginx.conf
|