public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/setup] update_services: Ensure pre-allocated users, groups, and tmpfiles are created in %%post
Date: Mon, 22 Jun 2026 15:56:25 GMT [thread overview]
Message-ID: <178214378528.1.4202522514046555144.rpms-setup-690241b0e3fb@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/setup
Branch : update_services
Commit : 690241b0e3fb46d90ef3b5da5358ca25e4fc5dbf
Author : Björn Esser <besser82@fedoraproject.org>
Date : 2024-12-27T22:01:48+01:00
Stats : +33/-3 in 1 file(s)
URL : https://src.fedoraproject.org/rpms/setup/c/690241b0e3fb46d90ef3b5da5358ca25e4fc5dbf?branch=update_services
Log:
Ensure pre-allocated users, groups, and tmpfiles are created in %%post
Some packages within the same transaction (e.g. during system-upgrades) may
rely on having the pre-allocated system users and/or system groups provided
by the setup package already to be present when the dependee package gets
installed; waiting for the %%transfiletriggerin to run `systemd-sysusers`
will be too late in such cases.
The above statement also applies for the temporary files from this package
to be created by running `systemd-tmpfiles`.
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---
diff --git a/setup.spec b/setup.spec
index 7067aeb..e85c42b 100644
--- a/setup.spec
+++ b/setup.spec
@@ -106,13 +106,15 @@ cat >%{buildroot}/usr/share/dnf5/libdnf.conf.d/protect-setup.conf <<EOF
protected_packages = setup
EOF
-#throw away useless and dangerous update stuff until rpm will be able to
-#handle it ( http://rpm.org/ticket/6 )
-# Use rpm.spawn() if available (in >= 4.20) but fallback to forking if not
%post -p <lua>
+-- Throw away useless and dangerous update stuff until rpm will be able to
+-- handle it. See: http://rpm.org/ticket/6
for i, name in ipairs({"passwd", "shadow", "group", "gshadow"}) do
os.remove("/etc/"..name..".rpmnew")
end
+-- Use rpm.spawn() if available (in >= 4.20) but fallback to forking if not.
+--
+-- Initialize or update /etc/alias.db from /etc/aliases for sendmail, etc.
if posix.access("/usr/bin/newaliases", "x") then
if rpm.spawn ~= nil then
rpm.spawn({'/usr/bin/newaliases'}, {stdout='/dev/null'})
@@ -126,6 +128,34 @@ if posix.access("/usr/bin/newaliases", "x") then
end
end
end
+-- Ensure pre-allocated users and groups are created immediately on upgrades.
+if posix.access("/usr/bin/systemd-sysusers", "x") then
+ if rpm.spawn ~= nil then
+ rpm.spawn({"/usr/bin/systemd-sysusers"}, {stderr='/dev/null'})
+ else
+ local pid = posix.fork()
+ if pid == 0 then
+ posix.redirect2null(2)
+ posix.exec("/usr/bin/systemd-sysusers")
+ elseif pid > 0 then
+ posix.wait(pid)
+ end
+ end
+end
+-- Ensure pre-allocated tmpfiles are created immediately on upgrades.
+if posix.access("/usr/bin/systemd-tmpfiles", "x") then
+ if rpm.spawn ~= nil then
+ rpm.spawn({"/usr/bin/systemd-tmpfiles", "--create"}, {stderr='/dev/null'})
+ else
+ local pid = posix.fork()
+ if pid == 0 then
+ posix.redirect2null(2)
+ posix.exec("/usr/bin/systemd-tmpfiles", "--create")
+ elseif pid > 0 then
+ posix.wait(pid)
+ end
+ end
+end
%files
%license docs/COPYING
reply other threads:[~2026-06-22 15:56 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=178214378528.1.4202522514046555144.rpms-setup-690241b0e3fb@fedoraproject.org \
--to=git-commits@fedoraproject.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