From patchwork Wed Mar 29 14:29:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 6748 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Pmpq66kphz3xCl for ; Wed, 29 Mar 2023 14:29:54 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Pmpq45rfYz2xR; Wed, 29 Mar 2023 14:29:52 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Pmpq44vwdz2yq0; Wed, 29 Mar 2023 14:29:52 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Pmpq41lffz2xYV for ; Wed, 29 Mar 2023 14:29:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4Pmpq24dVFzXT; Wed, 29 Mar 2023 14:29:50 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1680100190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=joHMu56xZ0IIMlDjXNJbbpeZ9DzRW86IcSex6Rexytk=; b=A63pJHWzEy2JtBGsQ6wmfW20T3qOi21rhFXSac+YCrDwWtuATbbfASbGOfBh5xW5g1nFYi Dbb82P/F9t0AlKCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1680100190; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=joHMu56xZ0IIMlDjXNJbbpeZ9DzRW86IcSex6Rexytk=; b=jHndr0A/8c/W/1fD9f0p2XaFV5+wwFG6DBOJSARsosu1++LAKjGJzdqSlM2aC5BdSeXuIq lUb6diiIgHb8LgkqiYKcYd3SVo9tuPdVwbq7Wg0NUEkFs6dln2bL48tyWBGz9dhCP/yHlY 750KFpYKDMtxHehgNPuCBk/2cgCZjwFhQZkQmr0chdhs8dJ2rUkpO+bydEZA2tAPAs5wS2 dvXyAFco0vaF3BwxUb00FAr+LMZDdA2Yfl/NfQ5HljuoseNNDtWhEiHhYXdBSHqTKSPmhq 1GOh9i2o+3IrUTWngfPn/6ay45EioKVzdb7v0HPrGVhrDvF5s9t7XUuPjD063A== From: Stefan Schantl 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 Message-Id: <20230329142943.2485040-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Signed-off-by: Stefan Schantl --- 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