commit:     b445c58ef8f61c4794da60af3ab18b3fec33f78c
Author:     Jaco Kroon <jaco <AT> iewc <DOT> co <DOT> za>
AuthorDate: Wed Feb 10 07:44:27 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Wed Feb 10 11:11:34 2021 +0000
URL:        https://gitweb.gentoo.org/data/api.git/commit/?id=b445c58e

used_free_uidgids.sh: Also count the free UID+GID pairs.

Signed-off-by: Jaco Kroon <jaco <AT> iewc.co.za>
Closes: https://github.com/gentoo/api-gentoo-org/pull/367
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 bin/used_free_uidgids.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/bin/used_free_uidgids.sh b/bin/used_free_uidgids.sh
index 3b43ac9..24cd682 100755
--- a/bin/used_free_uidgids.sh
+++ b/bin/used_free_uidgids.sh
@@ -174,6 +174,7 @@ gi=0 # index into gids array.
 idbase=0 # "start" of range about to be output.
 freeuid=0 # count number of free UIDs
 freegid=0 # count number of free GIDs
+freepair=0 # count number of free UID+GID pairs.
 
 printf "%-*s%10s%10s\n" $(( ${#max} * 2 + 5 )) "#ID" UID GID
 
@@ -238,6 +239,7 @@ while [[ ${idbase} -le ${max} ]]; do
        if [[ "${gidstate}" == FREE ]]; then
                if [[ "${uidstate}" == FREE ]]; then
                        uidgidboth=${re}
+                       freepair=$(( freepair + re - idbase + 1 ))
                else
                        gidonly=${re}
                fi
@@ -258,3 +260,4 @@ echo "Recommended UID only: ${uidonly:=${uidgidboth:-none}}"
 echo "Recommended UID+GID both: ${uidgidboth:-none}"
 echo "Free UIDs: ${freeuid}"
 echo "Free GIDs: ${freegid}"
+echo "Free UID+GID pairs: ${freepair}"

Reply via email to