Different way to search for existing PUID

Just grepping for PUID in /etc/passwd can accidentally catch group IDs with that same number. The `id` command returns whether or not there's a user with that ID more reliably.
This commit is contained in:
Alex Meyer 2021-07-31 23:12:21 -04:00 committed by GitHub
parent e0819f3791
commit bd51519c58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,7 +77,7 @@ else
fi
# Check if the PUID exists, if not create the user with the name 'qbittorrent', with the correct group
grep $"${PUID}:" /etc/passwd > /dev/null 2>&1
id ${PUID} > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "[INFO] An user with PUID $PUID already exists in /etc/passwd, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
else