From cca95abc4619e91186ef00a194c5b9616e570722 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Fri, 15 May 2026 16:33:47 -0700 Subject: [PATCH] Add sbin_compat bcond to rely on filesystem file triggers for sbin symlinks Instead of shipping /usr/sbin symlinks directly in the RPM, rely on filesystem(unmerged-sbin-symlinks) file triggers to create them at install time. This avoids file conflicts when the package (built on an unmerged system) is installed into a merged-sbin buildroot, eliminating the bootstrap ordering problem with the bin/sbin merge. On unmerged systems, the filesystem file trigger creates the symlinks when files are installed to /usr/bin. On merged systems, /usr/sbin is already a symlink to bin so no action is needed. The bcond defaults to enabled. Use --without sbin_compat to revert to the old behavior of shipping sbin symlinks in the package. --- systemd.spec | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/systemd.spec b/systemd.spec index 9bf8c7b..c172dc5 100644 --- a/systemd.spec +++ b/systemd.spec @@ -19,6 +19,12 @@ %bcond bootstrap 0 %bcond tests 1 +# When enabled, rely on filesystem(unmerged-sbin-symlinks) file triggers to +# create /usr/sbin symlinks instead of shipping them in the package. This +# avoids file conflicts when installing on merged-sbin systems and eliminates +# bootstrap ordering issues with the bin/sbin merge. +%bcond sbin_compat 1 + # riscv64 has LTO disabled globally %bcond lto %["%_arch" != "riscv64"] @@ -349,8 +355,7 @@ Provides: systemd-tmpfiles = %{version}-%{release} Conflicts: systemd-standalone-shutdown Provides: systemd-shutdown = %{version}-%{release} - -%if "%{_sbindir}" == "%{_bindir}" +%if %{with sbin_compat} || "%{_sbindir}" == "%{_bindir}" # Compat symlinks for Requires in other packages. # We rely on filesystem to create the symlinks for us. Requires: filesystem(unmerged-sbin-symlinks) @@ -547,7 +552,7 @@ Provides: systemd-repart = %{version}-%{release} Conflicts: xorg-x11-drv-evdev < 2.11.0 Conflicts: xorg-x11-drv-libinput < 1.5.0 -%if "%{_sbindir}" == "%{_bindir}" +%if %{with sbin_compat} || "%{_sbindir}" == "%{_bindir}" # Compat symlinks for Requires in other packages. # We rely on filesystem to create the symlinks for us. Requires: filesystem(unmerged-sbin-symlinks) @@ -1032,7 +1037,7 @@ sed -r 's|/system/|/user/|g' %{SOURCE16} >10-timeout-abort.conf.user %meson_install # udev links -%if "%{_sbindir}" != "%{_bindir}" +%if !%{with sbin_compat} && "%{_sbindir}" != "%{_bindir}" mkdir -p %{buildroot}/%{_sbindir} ln -sf ../bin/udevadm %{buildroot}%{_sbindir}/udevadm %endif @@ -1181,7 +1186,7 @@ install -Dm0644 -t %{buildroot}%{_prefix}/lib/systemd/network/ %{SOURCE25} ln -s --relative %{buildroot}%{_bindir}/kernel-install %{buildroot}%{_sbindir}/installkernel %endif -%if "%{_sbindir}" == "%{_bindir}" +%if %{with sbin_compat} || "%{_sbindir}" == "%{_bindir}" # Systemd has the split-sbin option which is also used to select the directory # for alias symlinks. We need to keep split-sbin=true for now, to support # unmerged systems. Move the symlinks here instead.