1
0
mirror of https://github.com/pi-hole/docker-pi-hole.git synced 2024-06-25 16:57:45 +02:00

Merge pull request #1404 from edgd1er/fix_uid_gid

[dev-v6]:extracted uid/gid functions need to be rewritten to remove the return
This commit is contained in:
Adam Warner 2023-07-26 22:03:25 +01:00 committed by GitHub
commit bfd8b1b380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,6 @@ if [ "${PH_VERBOSE:-0}" -gt 0 ] ; then
set -x ;
fi
# The below functions are all contained in bash_functions.sh
# shellcheck source=/dev/null
. /usr/bin/bash_functions.sh
@ -27,20 +26,24 @@ echo " [i] Starting docker specific checks & setup for docker pihole/pihole"
# If PIHOLE_UID is set, modify the pihole user's id to match
if [ -n "${PIHOLE_UID}" ]; then
currentId=$(id -u ${username})
[[ ${currentId} -eq ${PIHOLE_UID} ]] && return
currentId=$(id -u ${username})
if [[ ${currentId} -ne ${PIHOLE_UID} ]]; then
echo " [i] Changing ID for user: pihole (${currentId} => ${PIHOLE_UID})"
usermod -o -u ${PIHOLE_UID} pihole
else
echo " [i] ID for user pihole is already ${PIHOLE_UID}, no need to change"
fi
fi
# If PIHOLE_GID is set, modify the pihole group's id to match
if [ -n "${PIHOLE_GID}" ]; then
currentId=$(id -g pihole)
[[ ${currentId} -eq ${PIHOLE_GID} ]] && return
currentId=$(id -g pihole)
if [[ ${currentId} -ne ${PIHOLE_GID} ]]; then
echo " [i] Changing ID for group: pihole (${currentId} => ${PIHOLE_GID})"
groupmod -o -g ${PIHOLE_GID} pihole
else
echo " [i] ID for group pihole is already ${PIHOLE_GID}, no need to change"
fi
fi
fix_capabilities