diff --git a/cgconfig.service b/cgconfig.service index 6be383f99dc294153019da97b20782373441da4b..cc6a19f6c8512215ddc48417b555373c18faf9e9 100644 --- a/cgconfig.service +++ b/cgconfig.service @@ -11,8 +11,8 @@ Before=basic.target shutdown.target Type=oneshot RemainAfterExit=yes Delegate=yes -ExecStart=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf -s 1664 -ExecStop=/usr/sbin/cgclear -l /etc/cgconfig.conf -e +ExecStart=/usr/sbin/cgconfigparser -l /etc/cgconfig.conf -L /etc/cgconfig.d -s 1664 +ExecStop=/usr/sbin/cgclear -l /etc/cgconfig.conf -L /etc/cgconfig.d -e [Install] WantedBy=sysinit.target diff --git a/cgred.service b/cgred.service new file mode 100644 index 0000000000000000000000000000000000000000..dbc3e85e8b8755e52a84ad066287413277917e6f --- /dev/null +++ b/cgred.service @@ -0,0 +1,12 @@ +[Unit] +Description=CGroups Rules Engine Daemon +After=syslog.target nss-user-lookup.target + +[Service] +Type=forking +EnvironmentFile=-/etc/sysconfig/cgred +ExecStart=/usr/sbin/cgrulesengd $OPTIONS + +[Install] +WantedBy=multi-user.target + diff --git a/cgred.sysconfig b/cgred.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..b0d4967e7fe747948e5456df5565176e8a30e1bf --- /dev/null +++ b/cgred.sysconfig @@ -0,0 +1,4 @@ +# cgrulesengd command line options. See cgrulesengd(8). +CGROUP_LOGLEVEL="WARNING" +OPTIONS="-s -g cgred" + diff --git a/libcgroup.spec b/libcgroup.spec index ba2e8754c0efe79d9a74d1e0fc4d8911993714a4..e1e66423401b20cb80b817d1297bbbda623e4936 100644 --- a/libcgroup.spec +++ b/libcgroup.spec @@ -1,11 +1,14 @@ Summary: Library to control and monitor control groups Name: libcgroup Version: 3.1.0 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ URL: http://libcg.sourceforge.net/ Source0: https://github.com/%{name}/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz Source1: cgconfig.service +Source2: cgred.service +Source3: cgred.sysconfig + Patch5000: disable-creation-of-the-default-group-on-startup.patch BuildRequires: autoconf, automake, libtool, gcc, gcc-c++, make, systemd-devel BuildRequires: byacc, coreutils, flex, pam-devel, systemd-units @@ -45,8 +48,7 @@ This package provides API to create, delete and modify cgroup nodes. %build autoreconf -vif %configure --enable-pam-module-dir=%{_libdir}/security \ - --enable-opaque-hierarchy="name=systemd" \ - --disable-daemon + --enable-opaque-hierarchy="name=systemd" %make_build %install @@ -56,26 +58,31 @@ install -d %{buildroot}%{_sysconfdir} install -m644 samples/config/cgconfig.conf %{buildroot}/%{_sysconfdir}/cgconfig.conf install -m644 samples/config/cgsnapshot_denylist.conf %{buildroot}/%{_sysconfdir}/cgsnapshot_denylist.conf +install -d %{buildroot}/%{_sysconfdir}/cgconfig.d + rm -f %{buildroot}%{_libdir}/security/pam_cgroup.{,l}a -rm -f %{buildroot}%{_libdir}/security/pam_cgroup.so.* rm -f %{buildroot}%{_libdir}/*.{,l}a -rm -f %{buildroot}%{_libdir}/libcgroupfortesting.* rm -f %{buildroot}%{_mandir}/man5/cgred.conf.5* rm -f %{buildroot}%{_mandir}/man5/cgrules.conf.5* rm -f %{buildroot}%{_mandir}/man8/cgrulesengd.8* install -d %{buildroot}%{_unitdir} install -m644 %{SOURCE1} %{buildroot}%{_unitdir}/ +install -m644 %{SOURCE2} %{buildroot}%{_unitdir}/ install -d %{buildroot}%{_sysconfdir}/sysconfig +install -m644 %{SOURCE3} %{buildroot}%{_sysconfdir}/sysconfig/cgred + +%pre tools +getent group cgred >/dev/null || groupadd -r cgred %post tools -%systemd_post cgconfig.service +%systemd_post cgconfig.service cgred.service %preun tools -%systemd_preun cgconfig.service +%systemd_preun cgconfig.service cgred.service %postun tools -%systemd_postun_with_restart cgconfig.service +%systemd_postun_with_restart cgconfig.service cgred.service %files %license COPYING @@ -97,9 +104,12 @@ install -d %{buildroot}%{_sysconfdir}/sysconfig %{_bindir}/libcgroup_systemd_idle_thread %attr(0755, root, root) %{_bindir}/cgexec %{_sbindir}/cgconfigparser +%{_sbindir}/cgrulesengd %config(noreplace) %{_sysconfdir}/cgconfig.conf +%{_sysconfdir}/sysconfig/cgred %config(noreplace) %{_sysconfdir}/cgsnapshot_denylist.conf %{_unitdir}/cgconfig.service +%{_unitdir}/cgred.service %attr(0644, root, root) %{_mandir}/man1/* %attr(0644, root, root) %{_mandir}/man5/* %attr(0644, root, root) %{_mandir}/man8/* @@ -114,6 +124,9 @@ install -d %{buildroot}%{_sysconfdir}/sysconfig %{_libdir}/pkgconfig/libcgroup.pc %changelog +* Thu Mar 26 2026 cunshunxia - 3.1.0-4 +- support cgred. + * Thu Sep 26 2024 OpenCloudOS Release Engineering - 3.1.0-3 - Rebuilt for clarifying the packages requirement in BaseOS and AppStream