From 1a72578ed08072f40ef23a24a787277f7289c1fbb2a351e26b9f176e3475fbe8 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 2 May 2023 11:23:49 +0000 Subject: [PATCH 1/4] - Revert changes that dropped calls to %systemd_{pre,post} in the main package Until we switch to filetriggers these calls are needed when a new version of systemd introduced a new config file during an update. - We also introduce a new build conditional "%filetriggers" to identify easily which parts of the code will become obsolete when we'll switch to file triggers (WIP). This is important as this is unlikely to happen on SLE. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1378 --- systemd.changes | 12 ++++++++++++ systemd.spec | 40 ++++++++++++++++++++++++++++++---------- 2 files changed, 42 insertions(+), 10 deletions(-) diff --git a/systemd.changes b/systemd.changes index 6fd273e3..16ab984f 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue May 2 10:34:43 UTC 2023 - Franck Bui + +- Revert changes that dropped calls to %systemd_{pre,post} in the main package + + Until we switch to filetriggers these calls are needed when a new version of + systemd introduced a new config file during an update. + +- We also introduce a new build conditional "%filetriggers" to identify easily + which parts of the code will become obsolete when we'll switch to file + triggers (WIP). This is important as this is unlikely to happen on SLE. + ------------------------------------------------------------------- Fri Apr 28 10:43:02 UTC 2023 - Franck Bui diff --git a/systemd.spec b/systemd.spec index 29e9f363..444ccc7d 100644 --- a/systemd.spec +++ b/systemd.spec @@ -68,6 +68,7 @@ %bcond_without testsuite %endif # Kept to ease migrations toward SLE +%bcond_with filetriggers %bcond_with split_usr Name: systemd%{?mini} @@ -970,7 +971,17 @@ tar -cO \ # %%systemd_{pre,post} on them, which is fortunate since the helper script the # systemd rpm macros rely on is not yet installed. %pre -: +%if %{without filetriggers} +if [ $1 -gt 1 ]; then + # We keep these just in case we're upgrading from an old version that + # was missing these units. During package installation, these macros are + # NOPs for systemd anyways. + %systemd_pre remote-fs.target + %systemd_pre getty@.service + %systemd_pre systemd-timesyncd.service + %systemd_pre systemd-journald-audit.socket +fi +%endif %post # Make /etc/machine-id an empty file during package installation. On the first @@ -995,12 +1006,6 @@ pam-config --add --systemd || : %ldconfig %endif -# systemd-sysusers is not available in %pre so this needs to be done in -# %%post. However this shouldn't be an issue since all files the main package -# ships are owned by root. -%sysusers_create systemd-journal.conf -%sysusers_create systemd-timesync.conf - systemctl daemon-reexec || : # Reexecute user manager instances (if any). It is asynchronous but it shouldn't @@ -1017,13 +1022,28 @@ systemctl daemon-reexec || : # # systemctl kill --kill-who=main --signal=SIGRTMIN+25 "user@*.service" || : -if [ "$1" -eq 1 ]; then +if [ $1 -eq 1 ]; then # Persistent journal is the default mkdir -p %{_localstatedir}/log/journal fi -%journal_catalog_update -%tmpfiles_create +%if %{without filetriggers} +# During package installation, the followings are for config files shipped by +# packages that got installed before systemd and by the systemd main package +# itself. During update they deal with files that could have been introduced by +# new versions of systemd. +systemd-sysusers || : +systemd-tmpfiles --create || : +journalctl --update-catalog || : + +if [ $1 -gt 1 ]; then + # Same comment as the one for the %%systemd_pre() calls in %%pre. + %systemd_post remote-fs.target + %systemd_post getty@.service + %systemd_post systemd-timesyncd.service + %systemd_post systemd-journald-audit.socket +fi +%endif # v228 wrongly set world writable suid root permissions on timestamp files used # by permanent timers. Fix the timestamps that might have been created by the From 56582eb002d3ab43259cd69606b15b574b9fd304a829607f2e579189879cb963 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 2 May 2023 11:39:35 +0000 Subject: [PATCH 2/4] Update comments OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1379 --- systemd.spec | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/systemd.spec b/systemd.spec index 444ccc7d..c0b58b91 100644 --- a/systemd.spec +++ b/systemd.spec @@ -965,17 +965,13 @@ tar -cO \ # Don't drop %%pre section even if it becomes empty: the build process of # installation images uses a hardcoded list of packages with a %%pre that needs # to be run during the build and complains if it can't find one. -# -# Note: presets for units shipped by the main package are applied by %%posttrans -# scripts of systemd-presets-common-SUSE. Hence we don't need to bother running -# %%systemd_{pre,post} on them, which is fortunate since the helper script the -# systemd rpm macros rely on is not yet installed. %pre %if %{without filetriggers} if [ $1 -gt 1 ]; then # We keep these just in case we're upgrading from an old version that # was missing these units. During package installation, these macros are - # NOPs for systemd anyways. + # NOPs for systemd anyways (the branding preset package takes care of + # applying the presets in its %%posttrans in this case). %systemd_pre remote-fs.target %systemd_pre getty@.service %systemd_pre systemd-timesyncd.service From 2f6697b33012cbf21110f513ce281819e8340df2224c943572d195bc8b9196e7 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 2 May 2023 12:00:37 +0000 Subject: [PATCH 3/4] fix weird build error... OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1380 --- systemd.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/systemd.spec b/systemd.spec index c0b58b91..fbe0ebdf 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1033,7 +1033,7 @@ systemd-tmpfiles --create || : journalctl --update-catalog || : if [ $1 -gt 1 ]; then - # Same comment as the one for the %%systemd_pre() calls in %%pre. + # See comments for %%systemd_pre in %%pre. %systemd_post remote-fs.target %systemd_post getty@.service %systemd_post systemd-timesyncd.service From e6812965325131ee56e19c7741d018aea824363fc2723084757c5369d672f3d1 Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 2 May 2023 12:14:31 +0000 Subject: [PATCH 4/4] systemd_post/pre should be called in any cases (regardless of file triggers) OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=1381 --- systemd.spec | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/systemd.spec b/systemd.spec index fbe0ebdf..1b971cd7 100644 --- a/systemd.spec +++ b/systemd.spec @@ -966,18 +966,16 @@ tar -cO \ # installation images uses a hardcoded list of packages with a %%pre that needs # to be run during the build and complains if it can't find one. %pre -%if %{without filetriggers} if [ $1 -gt 1 ]; then # We keep these just in case we're upgrading from an old version that - # was missing these units. During package installation, these macros are - # NOPs for systemd anyways (the branding preset package takes care of - # applying the presets in its %%posttrans in this case). + # was missing one of these units. During package installation, these + # macros are NOPs for the main package (the branding preset package + # takes care of applying the presets in its %%posttrans in this case). %systemd_pre remote-fs.target %systemd_pre getty@.service %systemd_pre systemd-timesyncd.service %systemd_pre systemd-journald-audit.socket fi -%endif %post # Make /etc/machine-id an empty file during package installation. On the first @@ -1031,6 +1029,7 @@ fi systemd-sysusers || : systemd-tmpfiles --create || : journalctl --update-catalog || : +%endif if [ $1 -gt 1 ]; then # See comments for %%systemd_pre in %%pre. @@ -1039,7 +1038,6 @@ if [ $1 -gt 1 ]; then %systemd_post systemd-timesyncd.service %systemd_post systemd-journald-audit.socket fi -%endif # v228 wrongly set world writable suid root permissions on timestamp files used # by permanent timers. Fix the timestamps that might have been created by the