1 |
commit: b445c58ef8f61c4794da60af3ab18b3fec33f78c |
2 |
Author: Jaco Kroon <jaco <AT> iewc <DOT> co <DOT> za> |
3 |
AuthorDate: Wed Feb 10 07:44:27 2021 +0000 |
4 |
Commit: Joonas Niilola <juippis <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 10 11:11:34 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/data/api.git/commit/?id=b445c58e |
7 |
|
8 |
used_free_uidgids.sh: Also count the free UID+GID pairs. |
9 |
|
10 |
Signed-off-by: Jaco Kroon <jaco <AT> iewc.co.za> |
11 |
Closes: https://github.com/gentoo/api-gentoo-org/pull/367 |
12 |
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org> |
13 |
|
14 |
bin/used_free_uidgids.sh | 3 +++ |
15 |
1 file changed, 3 insertions(+) |
16 |
|
17 |
diff --git a/bin/used_free_uidgids.sh b/bin/used_free_uidgids.sh |
18 |
index 3b43ac9..24cd682 100755 |
19 |
--- a/bin/used_free_uidgids.sh |
20 |
+++ b/bin/used_free_uidgids.sh |
21 |
@@ -174,6 +174,7 @@ gi=0 # index into gids array. |
22 |
idbase=0 # "start" of range about to be output. |
23 |
freeuid=0 # count number of free UIDs |
24 |
freegid=0 # count number of free GIDs |
25 |
+freepair=0 # count number of free UID+GID pairs. |
26 |
|
27 |
printf "%-*s%10s%10s\n" $(( ${#max} * 2 + 5 )) "#ID" UID GID |
28 |
|
29 |
@@ -238,6 +239,7 @@ while [[ ${idbase} -le ${max} ]]; do |
30 |
if [[ "${gidstate}" == FREE ]]; then |
31 |
if [[ "${uidstate}" == FREE ]]; then |
32 |
uidgidboth=${re} |
33 |
+ freepair=$(( freepair + re - idbase + 1 )) |
34 |
else |
35 |
gidonly=${re} |
36 |
fi |
37 |
@@ -258,3 +260,4 @@ echo "Recommended UID only: ${uidonly:=${uidgidboth:-none}}" |
38 |
echo "Recommended UID+GID both: ${uidgidboth:-none}" |
39 |
echo "Free UIDs: ${freeuid}" |
40 |
echo "Free GIDs: ${freegid}" |
41 |
+echo "Free UID+GID pairs: ${freepair}" |