#!/bin/bash set -e # Default UID and GID if not specified PUID=${PUID:-101} PGID=${PGID:-101} # Default timezone if not specified TZ=${TZ:-Etc/UTC} # Set the timezone ln -snf /usr/share/zoneinfo/$TZ /etc/localtime echo "$TZ" >/etc/timezone echo "Timezone set to $TZ" # Adjust GID for the nsd group groupmod -o -g "$PGID" nsd echo "GID for group nsd adjusted to $PGID" # Adjust UID for the nsd user usermod -o -u "$PUID" nsd echo "UID for user nsd adjusted to $PUID" # Set correct permissions chown -R nsd:nsd /var/lib/nsd /var/run/nsd /etc/nsd echo "Permissions adjusted" # Start NSD in the foreground with reduced warnings echo "Starting NSD..." exec nsd -d