Clearer error message about PGID/PUID existence

Closes #108
This commit is contained in:
DyonR 2022-09-07 18:57:00 +02:00 committed by GitHub
parent d3a6da3c0c
commit 176a92a509
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,18 +72,18 @@ fi
# Check if the PGID exists, if not create the group with the name 'qbittorrent'
grep $"${PGID}:" /etc/group > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo "[INFO] A group with PGID $PGID already exists in /etc/group, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
echo "[INFO] A group with PGID $PGID already exists in /etc/group within this container, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[INFO] A group with PGID $PGID does not exist, adding a group called 'qbittorrent' with PGID $PGID" | ts '%Y-%m-%d %H:%M:%.S'
echo "[INFO] A group with PGID $PGID does not exist within this container, adding a group called 'qbittorrent' with PGID $PGID" | ts '%Y-%m-%d %H:%M:%.S'
groupadd -g $PGID qbittorrent
fi
# Check if the PUID exists, if not create the user with the name 'qbittorrent', with the correct group
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'
echo "[INFO] An user with PUID $PUID already exists within this container, nothing to do." | ts '%Y-%m-%d %H:%M:%.S'
else
echo "[INFO] An user with PUID $PUID does not exist, adding an user called 'qbittorrent user' with PUID $PUID" | ts '%Y-%m-%d %H:%M:%.S'
echo "[INFO] An user with PUID $PUID does not exist within this container, adding an user called 'qbittorrent user' with PUID $PUID" | ts '%Y-%m-%d %H:%M:%.S'
useradd -c "qbittorrent user" -g $PGID -u $PUID qbittorrent
fi