public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] man-db: Use sysusers mechanism for user/group creation
@ 2023-03-29 14:29 Stefan Schantl
  0 siblings, 0 replies; only message in thread
From: Stefan Schantl @ 2023-03-29 14:29 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 2377 bytes --]

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 man-db/man-db.nm       | 20 ++++++++------------
 man-db/man-db.sysusers |  6 ++++++
 2 files changed, 14 insertions(+), 12 deletions(-)
 create mode 100644 man-db/man-db.sysusers

diff --git a/man-db/man-db.nm b/man-db/man-db.nm
index 5d3240537..1f46ca8f0 100644
--- a/man-db/man-db.nm
+++ b/man-db/man-db.nm
@@ -5,7 +5,7 @@
 
 name       = man-db
 version    = 2.11.2
-release    = 1
+release    = 2
 
 groups     = Documentation
 url        = http://savannah.nongnu.org/projects/man-db
@@ -13,9 +13,9 @@ license    = GPL
 summary    = man-db is an on-line manual database.
 
 description
-	man-db is an implementation of the standard Unix documentation \
-	system accessed using the man command. It uses a Berkeley DB database \
-	in place of the traditional flat-text whatis databases. man-db is \
+	man-db is an implementation of the standard Unix documentation
+	system accessed using the man command. It uses a Berkeley DB database
+	in place of the traditional flat-text whatis databases. man-db is
 	used by several popular GNU/Linux distributions.
 end
 
@@ -28,6 +28,7 @@ build
 		groff
 		less
 		libpipeline-devel >= 1.5.0
+		systemd-basetools
 		systemd-devel
 		zlib-devel
 	end
@@ -54,14 +55,13 @@ build
 		mkdir -pv %{BUILDROOT}/var/cache/man
 
 		# Own the cache directory to the man user/group.
-		chown man:man %{BUILDROOT}/var/cache/man
+		chown -v man:man %{BUILDROOT}/var/cache/man
 	end
 end
 
 create_user
-	getent group man >/dev/null || groupadd -r -g 15 man
-	getent passwd man >/dev/null || useradd -r -g 15 \
-		-c "Manpage cache user" -d /var/cache/man -s /sbin/nologin man
+	cat %{DIR_SOURCE}/%{name}.sysusers |
+		systemd-sysusers --replace=%{sysusersdir}/%{name}.conf -
 end
 
 packages
@@ -83,10 +83,6 @@ packages
 			man
 		end
 
-		script prein
-			%{create_user}
-		end
-
 		script posttransin
 			# Update the database right now.
 			rm -rf /var/cache/man/*
diff --git a/man-db/man-db.sysusers b/man-db/man-db.sysusers
new file mode 100644
index 000000000..3783bed2c
--- /dev/null
+++ b/man-db/man-db.sysusers
@@ -0,0 +1,6 @@
+# Create the man group with GID 15
+g man 15
+
+# Create the man user with UID 15, member of the man group
+# with a remark, /var/cache/man as homedir and no login shell.
+u man 15:15 "Manpage cache user" /var/cache/man /sbin/nologin
-- 
2.30.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-29 14:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 14:29 [PATCH] man-db: Use sysusers mechanism for user/group creation Stefan Schantl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox