Skip to content

Commit ae2c0d2

Browse files
committed
rpmostree-core: Reload user/groups after each %post script
As part of the migration to direct sysusers support in RPMs, packages are no longer creating their users/groups in %pre scripts as they rely on RPM to do the work. In rpm-ostree unified core composes, the users/groups are not created this way as we don't use/call out to those new RPM scriptlets. Thus the "new" users (i.e. those not part of the default `passwd` & `group` files set in the manifests) are created when the systemd %post scriptlet runs the `sysusers` command. As a workaround, we now reload the list of users/groups after each %post to make sure it is up-to-date. See: https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers See: rpm-software-management/rpm@009d139 See: fedora-silverblue/issue-tracker#636 See: https://gitlab.com/fedora/ostree/sig/-/issues/70 See: #5333
1 parent 73ba30d commit ae2c0d2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/libpriv/rpmostree-core.cxx

+10-10
Original file line numberDiff line numberDiff line change
@@ -4518,23 +4518,23 @@ rpmostree_context_assemble (RpmOstreeContext *self, GCancellable *cancellable, G
45184518
return FALSE;
45194519
}
45204520

4521-
if (faccessat (tmprootfs_dfd, "etc/passwd", F_OK, 0) == 0)
4522-
{
4523-
CXX_TRY (passwd_entries->add_passwd_content (tmprootfs_dfd, "etc/passwd"), error);
4524-
}
4525-
4526-
if (faccessat (tmprootfs_dfd, "etc/group", F_OK, 0) == 0)
4527-
{
4528-
CXX_TRY (passwd_entries->add_group_content (tmprootfs_dfd, "etc/group"), error);
4529-
}
4530-
45314521
{
45324522
auto task = rpmostreecxx::progress_begin_task ("Running post scripts");
45334523
guint n_post_scripts_run = 0;
45344524

45354525
/* %post */
45364526
for (guint i = 0; i < n_rpmts_elements; i++)
45374527
{
4528+
if (faccessat (tmprootfs_dfd, "etc/passwd", F_OK, 0) == 0)
4529+
{
4530+
CXX_TRY (passwd_entries->add_passwd_content (tmprootfs_dfd, "etc/passwd"), error);
4531+
}
4532+
4533+
if (faccessat (tmprootfs_dfd, "etc/group", F_OK, 0) == 0)
4534+
{
4535+
CXX_TRY (passwd_entries->add_group_content (tmprootfs_dfd, "etc/group"), error);
4536+
}
4537+
45384538
rpmte te = rpmtsElement (ordering_ts, i);
45394539
if (rpmteType (te) != TR_ADDED)
45404540
continue;

0 commit comments

Comments
 (0)