Skip to content

Commit

Permalink
used_free_uidgids.sh: Also count the free UID+GID pairs.
Browse files Browse the repository at this point in the history
Signed-off-by: Jaco Kroon <[email protected]>
Closes: #367
Signed-off-by: Joonas Niilola <[email protected]>
  • Loading branch information
Jaco Kroon authored and juippis committed Feb 10, 2021
1 parent 0aaf769 commit b445c58
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bin/used_free_uidgids.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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}"

0 comments on commit b445c58

Please sign in to comment.