add contrib

This commit is contained in:
Motiejus Jakštys 2022-07-04 07:00:05 +03:00
parent eaccd00960
commit 1fac779f5f
2 changed files with 42 additions and 0 deletions

30
contrib/assign0.awk Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/awk -f
# Assign a new uid for users that have uid=0
BEGIN {
FS=":";
max_uid = 0;
i = 0;
}
{
max_uid = ($3 > max_uid ? $3 : max_uid);
if ($3 == "0") {
uid0[i] = $0;
} else {
good[i] = $0;
}
i += 1;
}
END {
for (i in good) {
print good[i];
}
for (i in uid0) {
max_uid += 1;
split(uid0[i], f, ":");
print f[1]":"f[2]":"max_uid":"f[4]":"f[5]":"f[6]":"f[7];
}
}

12
contrib/remove_dupe_gids.awk Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/awk -f
#
# Remove groups that have duplicate gids. The first group wins.
BEGIN{ FS=":" }
{
if ($3 in gids) {
print "duplicate gid="$3" name="$1", ignoring" > "/dev/stderr";
next;
}
gids[$3]=$0;
print $0;
}