Invert group modification, redirect getent query to /dev/null

This commit is contained in:
flow.gunso
2019-04-09 14:23:24 +02:00
parent 8a66e3993d
commit 9968775927

View File

@@ -36,11 +36,11 @@ if [ "$UID" != "1000" ]; then
fi fi
# Change the group, if the $GID changed. # Change the group, if the $GID changed.
if [ "$GID" != "1000" ]; then if [ "$GID" != "1000" ]; then
getent group | grep ":$GID:" getent group | grep ":$GID:" &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 1 ]; then
groupmod -g $GID $UNAME usermod -g $GID -G 1000 $UNAME
else else
usermod -g $UID -G $GID $UNAME groupmod -g $GID $UNAME
fi fi
fi fi