setup/backport-uidgid-simplify-table-format-by-properly-commenting.patch

62 lines
2.3 KiB
Diff

From c2d8d46b12679490896a795111919d18c8faa089 Mon Sep 17 00:00:00 2001
From: Luca BRUNO <luca.bruno@coreos.com>
Date: Mon, 30 May 2022 09:41:18 +0000
Subject: [PATCH] uidgid: simplify table format by properly commenting lines
This tweaks the `uidgid` table by commenting out some lines which
do not actually hold any UID/GID.
The goal is to have this data in a more structured format, in order
to be more machine-friendly and easier to parse.
---
uidgid | 6 +++---
uidgidlint | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/uidgid b/uidgid
index 3396364..8381b88 100644
--- a/uidgid
+++ b/uidgid
@@ -1,4 +1,4 @@
-NAME UID GID HOME SHELL PACKAGES
+#NAME UID GID HOME SHELL PACKAGES
root 0 0 /root /bin/bash setup
bin 1 1 /bin /sbin/nologin setup
daemon 2 2 /sbin /sbin/nologin setup
@@ -164,6 +164,6 @@ systemd-journal - 190 - - systemd
#systemd-journal-gateway 191 191 / /sbin/nologin systemd #dynamic on new systems, removed Dec2014, can be freed if necessary later
systemd-network 192 192 / /sbin/nologin systemd
systemd-resolve 193 193 / /sbin/nologin systemd
-gnats ? ? ? ? gnats, gnats-db
-listar ? ? ? ? listar
+#gnats ? ? ? ? gnats, gnats-db
+#listar ? ? ? ? listar
nobody 65534 65534 / /sbin/nologin setup
diff --git a/uidgidlint b/uidgidlint
index 9c88ab8..902f55e 100755
--- a/uidgidlint
+++ b/uidgidlint
@@ -7,16 +7,16 @@ fi
error=0
# The format of the file is (currently)
for infile in "$@" ; do
- uidlist=`tail -n +2 "$infile" | awk '{print $2}' | grep -v '?' | grep -v -e - | sort -nu`
- gidlist=`tail -n +2 "$infile" | awk '{print $3}' | grep -v '?' | grep -v -e - | sort -nu`
+ uidlist=`grep -v '^#' "$infile" | awk '{print $2}' | grep -v -e - | sort -nu`
+ gidlist=`grep -v '^#' "$infile" | awk '{print $3}' | grep -v -e - | sort -nu`
for uid in $uidlist ; do
- if test `tail -n +2 "$infile" | awk '{print $2}' | grep '^'"$uid"'$' | wc -l` -ne 1 ; then
+ if test `grep -v '^#' "$infile" | awk '{print $2}' | grep '^'"$uid"'$' | wc -l` -ne 1 ; then
echo Duplicate UID: $uid
error=1
fi
done
for gid in $gidlist ; do
- if test `tail -n +2 "$infile" | awk '{print $3}' | grep '^'"$gid"'$' | wc -l` -ne 1 ; then
+ if test `grep -v '^#' "$infile" | awk '{print $3}' | grep '^'"$gid"'$' | wc -l` -ne 1 ; then
echo Duplicate GID: $gid
error=1
fi
--
2.27.0