public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] man-db: Use sysusers mechanism for user/group creation
Date: Wed, 29 Mar 2023 16:29:43 +0200	[thread overview]
Message-ID: <20230329142943.2485040-1-stefan.schantl@ipfire.org> (raw)

[-- 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


                 reply	other threads:[~2023-03-29 14:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230329142943.2485040-1-stefan.schantl@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox