Skip to content

Commit

Permalink
systemd: use bootconfig for unified cgroup hierarchy
Browse files Browse the repository at this point in the history
Instead of changing the way that systemd is compiled based on the
image feature flag, the expected init parameter can be added to a
bootconfig drop-in.

If necessary, the cgroup hierarchy setting can still be overridden at
runtime or by replacing the default bootconfig file.

Signed-off-by: Ben Cressey <[email protected]>
  • Loading branch information
bcressey committed Apr 10, 2024
1 parent 1e3c68e commit f386a02
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion packages/systemd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ path = "../packages.rs"

[package.metadata.build-package]
releases-url = "https://github.com/systemd/systemd-stable/releases"
package-features = ["unified-cgroup-hierarchy"]

[[package.metadata.build-package.external-files]]
url = "https://github.com/systemd/systemd-stable/archive/v252.22/systemd-stable-252.22.tar.gz"
Expand Down
1 change: 1 addition & 0 deletions packages/systemd/bootconfig-unified-cgroup-hierarchy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
init.systemd.unified_cgroup_hierarchy = 1
20 changes: 16 additions & 4 deletions packages/systemd/systemd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Source3: journald.conf
Source4: issue
Source5: systemd-journald.conf
Source6: systemd-sysusers.conf
Source7: bootconfig-unified-cgroup-hierarchy.conf

# Backport of upstream patches that make the netlink default timeout
# configurable. Bottlerocket carries this patch and configures the timeout in
Expand Down Expand Up @@ -130,6 +131,15 @@ Summary: Files for resolved
%description resolved
%{summary}.

%package unified-cgroup-hierarchy
Summary: Bootconfig snippet for unified cgroup hierarchy
Requires: (%{_cross_os}image-feature(unified-cgroup-hierarchy) and %{name})
Supplements: (%{_cross_os}image-feature(unified-cgroup-hierarchy) and %{name})
Conflicts: %{_cross_os}image-feature(no-unified-cgroup-hierarchy)

%description unified-cgroup-hierarchy
%{summary}.

%prep
%autosetup -n systemd-stable-%{version} -p1

Expand Down Expand Up @@ -204,11 +214,7 @@ CONFIGURE_OPTS=(
-Dpkgconfigdatadir='%{_cross_pkgconfigdir}'
-Dpkgconfiglibdir='%{_cross_pkgconfigdir}'

%if %{with unified_cgroup_hierarchy}
-Ddefault-hierarchy=unified
%else
-Ddefault-hierarchy=hybrid
%endif

-Dadm-group=false
-Dwheel-group=false
Expand Down Expand Up @@ -321,6 +327,9 @@ rm -f %{buildroot}%{_cross_libdir}/systemd/{system,user}/graphical.target
install -d %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}
install -p -m 0644 %{S:4} %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/issue

install -d %{buildroot}%{_cross_bootconfigdir}
install -p -m 0644 %{S:7} %{buildroot}%{_cross_bootconfigdir}/10-unified-cgroup-hierarchy.conf

%files
%license LICENSE.GPL2 LICENSE.LGPL2.1
%{_cross_attribution_file}
Expand Down Expand Up @@ -509,4 +518,7 @@ install -p -m 0644 %{S:4} %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/i
%exclude %{_cross_bindir}/systemd-resolve
%exclude %{_cross_sbindir}/resolvconf

%files unified-cgroup-hierarchy
%{_cross_bootconfigdir}/10-unified-cgroup-hierarchy.conf

%changelog

0 comments on commit f386a02

Please sign in to comment.