Skip to content

Commit

Permalink
Merge pull request #3886 from bcressey/unified-cgroup-bootconfig
Browse files Browse the repository at this point in the history
systemd: use bootconfig for unified cgroup hierarchy
  • Loading branch information
bcressey authored Apr 12, 2024
2 parents 2b71061 + bac6f6e commit c7df387
Show file tree
Hide file tree
Showing 3 changed files with 32 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
35 changes: 31 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 @@ -102,6 +103,10 @@ Requires: %{_cross_os}libselinux
Requires: %{_cross_os}libuuid
Requires: %{_cross_os}libxcrypt

# Only require a cgroup hierarchy package when building an image, not
# for packages that need systemd-devel as a build dependency.
Requires: (%{name}(cgroup-hierarchy) if %{_cross_os}metadata)

%description
%{summary}.

Expand Down Expand Up @@ -130,6 +135,24 @@ Summary: Files for resolved
%description resolved
%{summary}.

%package hybrid-cgroup-hierarchy
Summary: No-op dependency for hybrid cgroup hierarchy
Provides: %{name}(cgroup-hierarchy)
Requires: (%{_cross_os}image-feature(no-unified-cgroup-hierarchy) and %{name})
Conflicts: (%{_cross_os}image-feature(unified-cgroup-hierarchy) or %{name}-unified-cgroup-hierarchy)

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

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

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

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

Expand Down Expand Up @@ -204,11 +227,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 +340,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 +531,9 @@ install -p -m 0644 %{S:4} %{buildroot}%{_cross_factorydir}%{_cross_sysconfdir}/i
%exclude %{_cross_bindir}/systemd-resolve
%exclude %{_cross_sbindir}/resolvconf

%files hybrid-cgroup-hierarchy

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

%changelog

0 comments on commit c7df387

Please sign in to comment.