From f7899d654a205d7bab434bef40cc360b76c3b908 Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Sun, 2 Dec 2018 23:21:21 +0000 Subject: [PATCH] Count users in a better way --- src/freedombone-utils-webadmin | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/freedombone-utils-webadmin b/src/freedombone-utils-webadmin index c5bc7c8e0..f16abeb2e 100755 --- a/src/freedombone-utils-webadmin +++ b/src/freedombone-utils-webadmin @@ -299,6 +299,8 @@ function web_admin_create_users { rm "$webadmin_install_dir/userprofile_"* + no_of_users=0 + for d in /home/*/ ; do USERNAME=$(echo "$d" | awk -F '/' '{print $3}') if [[ $(is_valid_user "$USERNAME") == "1" ]]; then @@ -338,6 +340,8 @@ function web_admin_create_users { echo ' </a>'; echo ' </div>'; } >> "$users_file" + no_of_users=$((no_of_users+1)) + cp "$webadmin_install_dir"/userprofile.html "$userfile" sed -i "s|USERNAME|${USERNAME}|g" "$userfile" if [[ "$USERNAME" == "$ADMIN_USER" ]]; then @@ -363,9 +367,6 @@ function web_admin_create_users { translated_add_user=$(web_admin_translate_text "Add a new member") - # shellcheck disable=SC2126 - no_of_users=$(find /home/ -maxdepth 1 -type d | grep -Fxv "/home/znc" | grep -Fxv "/home/turtl" | grep -Fxv "/home/go" | grep -Fxv "/home/gogs" | grep -Fxv "/home/git" | grep -Fxv "/home/pihole" | grep -Fxv "/home/" | grep -Fxv "/home/tahoelafs" | grep -Fxv "/home/sync" | wc -l) - # shellcheck disable=SC2086 if [ $no_of_users -lt $MAXIMUM_USERS ]; then { echo ' <div class="chip">'; -- GitLab