1#!/bin/bash
2set -e
3 4# Get current UID/GID from environment or use defaults 5USER_ID=${PUID:-$(stat -c '%u'"$SMALLWEB_DIR")} 6GROUP_ID=${PGID:-$(stat -c '%g'"$SMALLWEB_DIR")} 7 8if["$USER_ID"="0"];then 9exec /usr/local/bin/smallweb "$@"10fi1112if["$(id -u smallweb)" !="$USER_ID"];then13echo"Updating user 'smallweb' with new UID -> $USER_ID"14 usermod -u "$USER_ID" smallweb
15fi1617if["$(id -g smallweb)" !="$GROUP_ID"];then18echo"Updating group 'smallweb' with new GID -> $GROUP_ID"19 groupmod -g "$GROUP_ID" smallweb
20fi2122# Execute the command as the smallweb user23exec gosu smallweb:smallweb /usr/local/bin/smallweb "$@"