1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 02:14:48 +00:00
librenms-docker/rootfs/etc/cont-init.d/01-fix-uidgid.sh
2019-11-19 14:10:17 +01:00

11 lines
497 B
Bash

#!/usr/bin/with-contenv sh
if [ -n "${PGID}" ] && [ "${PGID}" != "$(id -g librenms)" ]; then
echo "Switching to PGID ${PGID}..."
sed -i -e "s/^librenms:\([^:]*\):[0-9]*/librenms:\1:${PGID}/" /etc/group
sed -i -e "s/^librenms:\([^:]*\):\([0-9]*\):[0-9]*/librenms:\1:\2:${PGID}/" /etc/passwd
fi
if [ -n "${PUID}" ] && [ "${PUID}" != "$(id -u librenms)" ]; then
echo "Switching to PUID ${PUID}..."
sed -i -e "s/^librenms:\([^:]*\):[0-9]*:\([0-9]*\)/librenms:\1:${PUID}:\2/" /etc/passwd
fi