public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/setup] update_services: Ensure pre-allocated users, groups, and tmpfiles are created in %%post
@ 2026-06-22 15:56
0 siblings, 0 replies; only message in thread
From: @ 2026-06-22 15:56 UTC (permalink / raw)
To: git-commits
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-22 15:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 15:56 [rpms/setup] update_services: Ensure pre-allocated users, groups, and tmpfiles are created in %%post
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox