diff --git a/src/freedombone-adduser b/src/freedombone-adduser index cd1f5f9269dd5d8cf72c6a418685080fe2601591..5281292c18afc9bc71e7c493bb417aa637561f68 100755 --- a/src/freedombone-adduser +++ b/src/freedombone-adduser @@ -73,6 +73,15 @@ if [ ! -f "$COMPLETION_FILE" ]; then exit 3 fi +# shellcheck disable=SC2126 +no_of_users=$(find /home/ -maxdepth 1 -type d | grep -Fxv "/home/go" | grep -Fxv "/home/gogs" | grep -Fxv "/home/pihole" | grep -Fxv "/home/" | wc -l) + +# shellcheck disable=SC2086 +if [ $no_of_users -ge 10 ]; then + echo $"Maximum number of users reached" + exit 4 +fi + # Minimum number of characters in a password MINIMUM_PASSWORD_LENGTH=$(grep 'MINIMUM_PASSWORD_LENGTH=' "/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-passwords" | head -n 1 | awk -F '=' '{print $2}')