From 9166bcc3b4842e8f166a3ec6bc0c89d40981e451 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Mon, 13 Feb 2012 20:03:04 +0000 Subject: [PATCH] - 0.38.rc1 - removed obsolete patches - added systemd support - drop support for default cgroup creation - simplified cgred sysconfig file Changed files: cgconfig.init -> 1.10 cgconfig.service -> 1.1 cgred.init -> 1.15 cgred.service -> 1.1 cgred.sysconfig -> 1.1 libcgroup-0.36.2-systemd.patch -> 1.2 libcgroup-0.37.1-systemd.patch -> 1.2 libcgroup-group-write.patch -> 1.3 libcgroup.spec -> 1.26 --- cgconfig.init | 48 -------- cgconfig.service | 17 +++ cgred.init | 13 +-- cgred.service | 11 ++ cgred.sysconfig | 2 + libcgroup-0.36.2-systemd.patch | 24 ---- libcgroup-0.37.1-systemd.patch | 194 --------------------------------- libcgroup-group-write.patch | 168 ---------------------------- libcgroup.spec | 70 +++++++++--- 9 files changed, 85 insertions(+), 462 deletions(-) create mode 100644 cgconfig.service create mode 100644 cgred.service create mode 100644 cgred.sysconfig delete mode 100644 libcgroup-0.36.2-systemd.patch delete mode 100644 libcgroup-0.37.1-systemd.patch delete mode 100644 libcgroup-group-write.patch diff --git a/cgconfig.init b/cgconfig.init index e1c60da..2d1feaf 100644 --- a/cgconfig.init +++ b/cgconfig.init @@ -10,53 +10,8 @@ . /etc/rc.d/init.d/functions # read the config -CREATE_DEFAULT=yes [ -f /etc/sysconfig/cgconfig ] && . /etc/sysconfig/cgconfig -create_default_groups() { - local defaultcgroup controllers - if [ -f /etc/cgrules.conf ]; then - defaultcgroup=$(awk '/^\*[\t ]+/ { print $3; exit }' /etc/cgrules.conf) - if [ -n "$defaultcgroup" -a "$defaultcgroup" = "*" ]; then - # nls "/etc/cgrules.conf incorrect. Overriding it" - defaultcgroup= - fi - fi - - if [ -z $defaultcgroup ]; then - defaultcgroup=sysdefault/ - fi - - # - # Find all mounted subsystems and create comma-separated list - # of controllers. - # - controllers=$(lssubsys 2>/dev/null | awk '{ if (v) v=v","$0 ; else v=$0 } END { printf "%s", v }') - - # - # Create the default group, ignore errors when the default group - # already exists. - # - cgcreate -f 664 -d 775 -g $controllers:$defaultcgroup 2>/dev/null - - # - # special rule for cpusets - # - if echo $controllers | grep -q -w cpuset; then - local cpus mems - cpus=$(cgget -nv -r cpuset.cpus /) - cgset -r cpuset.cpus=$cpus $defaultcgroup - mems=$(cgget -nv -r cpuset.mems /) - cgset -r cpuset.mems=$mems $defaultcgroup - fi - - # - # Classify everything to default cgroup. Ignore errors, some processes - # may exit after ps is run and before cgclassify moves them. - # - cgclassify -g $controllers:$defaultcgroup $(ps --no-headers -eL o tid) 2>/dev/null || : -} - start() { # Check if the service is already running? if [ -f /var/lock/subsys/cgconfig ]; then @@ -78,9 +33,6 @@ start() { exit $RETVAL fi - if is_yes "$CREATE_DEFAULT"; then - create_default_groups - fi RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/cgconfig ok diff --git a/cgconfig.service b/cgconfig.service new file mode 100644 index 0000000..6650b4a --- /dev/null +++ b/cgconfig.service @@ -0,0 +1,17 @@ +[Unit] +Description=Control Group configuration service + +# The service should be able to start as soon as possible, +# before any 'normal' services: +DefaultDependencies=no +Conflicts=shutdown.target +Before=basic.target shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/sbin/cgconfigparser -l /etc/cgconfig.conf -s 664 +ExecStop=/sbin/cgclear -l /etc/cgconfig.conf -e + +[Install] +WantedBy=sysinit.target diff --git a/cgred.init b/cgred.init index ccb20a8..4d117a7 100644 --- a/cgred.init +++ b/cgred.init @@ -12,6 +12,9 @@ # Source function library . /etc/rc.d/init.d/functions +# Read in configuration options. +[ -f /etc/sysconfig/cgred ] && . /etc/sysconfig/cgred + start() { if [ -f /var/lock/subsys/cgred ]; then msg_already_running "CGroup Rules Engine Daemon" @@ -30,16 +33,6 @@ start() { fi msg_starting "CGroup Rules Engine Daemon" - # Read in configuration options. - OPTIONS="" - if [ -f /etc/sysconfig/cgred.conf ]; then - . /etc/sysconfig/cgred.conf - - OPTIONS="$NODAEMON $LOG" - [ -n "$LOG_FILE" ] && OPTIONS="$OPTIONS --logfile=$LOG_FILE" - [ -n "$SOCKET_USER" ] && OPTIONS="$OPTIONS -u $SOCKET_USER" - [ -n "$SOCKET_GROUP" ] && OPTIONS="$OPTIONS -g $SOCKET_GROUP" - fi daemon --pidfile /var/run/cgrulesengd.pid /sbin/cgrulesengd $OPTIONS RETVAL=$? diff --git a/cgred.service b/cgred.service new file mode 100644 index 0000000..6cfda2b --- /dev/null +++ b/cgred.service @@ -0,0 +1,11 @@ +[Unit] +Description=CGroups Rules Engine Daemon +After=syslog.target + +[Service] +Type=forking +EnvironmentFile=-/etc/sysconfig/cgred +ExecStart=/sbin/cgrulesengd -n $OPTIONS + +[Install] +WantedBy=multi-user.target diff --git a/cgred.sysconfig b/cgred.sysconfig new file mode 100644 index 0000000..b05716e --- /dev/null +++ b/cgred.sysconfig @@ -0,0 +1,2 @@ +# cgrulesengd command line options. See cgrulesengd(8). +OPTIONS="-s -g cgred" diff --git a/libcgroup-0.36.2-systemd.patch b/libcgroup-0.36.2-systemd.patch deleted file mode 100644 index e1cf0c5..0000000 --- a/libcgroup-0.36.2-systemd.patch +++ /dev/null @@ -1,24 +0,0 @@ -Ignore systemd hierarchy. Quick&dirity fix for bug #627378 - -Author: Dhaval Giani - -@@ -, +, @@ - src/api.c | 8 ++++++++ - 1 file changed, 8 insertions(+) ---- libcgroup-0.36.2/src/api.c -+++ libcgroup-0.36.2/src/api.c -@@ -772,6 +772,14 @@ int cgroup_init(void) - * Check if it is a duplicate - */ - duplicate = 0; -+ -+ /* -+ * Ignore anything to do with systemd -+ */ -+ if (strncmp(mntopt, "name=systemd", -+ strlen("name=systemd")) == 0) -+ continue; -+ - for (j = 0; j < found_mnt; j++) { - if (strncmp(mntopt, cg_mount_table[j].name, - FILENAME_MAX) == 0) { diff --git a/libcgroup-0.37.1-systemd.patch b/libcgroup-0.37.1-systemd.patch deleted file mode 100644 index 8512201..0000000 --- a/libcgroup-0.37.1-systemd.patch +++ /dev/null @@ -1,194 +0,0 @@ -702111 - Starting LSB: start and stop the WLM configuration failed - - - cgconfigparser should not unmount stuff it did not mounted - - cgconfigparser should accept empty config file - - rename the service - -Backported these 3 pacthes: - -commit 7155cc27430619be5ffcf1ddc2b6bd8cf7d6d7e0 -Author: Dhaval Giani -Date: Fri May 27 10:36:19 2011 +0200 - - cgconfig: Do not touch subsystems not mounted by cgconfig - - cgconfig: Do not touch subsystems not mounted by cgconfig - - In its failure path, cgconfig should only touch the subsystems - it had something to do with. Currently, it unmounts all the - subsystems in the config file. Correct this. - - Signed-off-by: Dhaval Giani - Signed-off-by: Jan Safranek - -commit 431587f4e21b36a3f08bc595d716a70d70314e70 -Author: Jan Safranek -Date: Fri May 20 15:53:05 2011 +0200 - - Updated cgconfig service descriptions - - Signed-off-by: Jan Safranek - -commit 74e1b1e3d04c2f7999e367a20bf73396b61f9b64 -Author: Jan Safranek -Date: Fri May 20 15:52:58 2011 +0200 - - Fixed cgconfigparser to allow configs with no 'mount' section - - cgconfig service fails when something else mounts cgroup hierarchies during - boot (e.g. systemd). Therefore we should allow cgconfig.conf to have no - 'mount' section -> it's up to admin to ensure that controllers are mounted as - needed. - - Because 'group' section is already optional, with this patch cgconfigparser - will accept empty configuration file. This is probably the best default - config for distros with systemd. - - Changelog: - - fixed case with empty config file and no mounted controllers - - reworked the if conditions to be more clear - - Signed-off-by: Jan Safranek - -diff -up libcgroup-0.37.1/doc/man/cgconfig.conf.5.systemd2 libcgroup-0.37.1/doc/man/cgconfig.conf.5 ---- libcgroup-0.37.1/doc/man/cgconfig.conf.5.systemd2 2011-03-03 09:29:41.000000000 +0100 -+++ libcgroup-0.37.1/doc/man/cgconfig.conf.5 2011-05-30 15:06:45.083249011 +0200 -@@ -12,8 +12,8 @@ The file consists of - .I mount - and - .I group --sections. These sections can be in arbitrary order. Any line starting with --'#' is considered as a comment line and is ignored. -+sections. These sections can be in arbitrary order and both are optional. -+Any line starting with '#' is considered as a comment line and is ignored. - .LP - .I mount - section has this form: -@@ -50,6 +50,11 @@ controller, shall be mounted. The direct - automatically on cgconfig service startup if it does not exist and - is deleted on service shutdown. - .LP -+ -+If no -+.I mount -+section is specified, no controllers are mounted. -+ - .I group - section has this form: - .RS -@@ -171,6 +176,10 @@ created. Optionally it can be enclosed i - contain spaces then. - .RE - -+If no -+.I group -+section is specified, no groups are created. -+ - .\"********************************************" - .SH EXAMPLES - .LP -diff -up libcgroup-0.37.1/scripts/init.d/cgconfig.in.systemd2 libcgroup-0.37.1/scripts/init.d/cgconfig.in ---- libcgroup-0.37.1/scripts/init.d/cgconfig.in.systemd2 2011-05-30 15:00:36.269947252 +0200 -+++ libcgroup-0.37.1/scripts/init.d/cgconfig.in 2011-05-30 15:00:36.284946695 +0200 -@@ -25,8 +25,8 @@ - # Required-Stop: - # Should-Start: - # Should-Stop: --# Short-Description: start and stop the WLM configuration --# Description: This script allows us to create a default configuration -+# Short-Description: Create and setup control group filesystem(s) -+# Description: Create and setup control group filesystem(s) - ### END INIT INFO - - # get correct location of binaries from configure -diff -up libcgroup-0.37.1/src/config.c.systemd2 libcgroup-0.37.1/src/config.c ---- libcgroup-0.37.1/src/config.c.systemd2 2011-03-03 09:29:41.000000000 +0100 -+++ libcgroup-0.37.1/src/config.c 2011-05-30 15:17:08.317101247 +0200 -@@ -394,6 +394,7 @@ static int cgroup_config_mount_fs(void) - int ret; - struct stat buff; - int i; -+ int error; - - for (i = 0; i < config_table_index; i++) { - struct cg_mount_table_s *curr = &(config_mount_table[i]); -@@ -402,26 +403,39 @@ static int cgroup_config_mount_fs(void) - - if (ret < 0 && errno != ENOENT) { - last_errno = errno; -- return ECGOTHER; -+ error = ECGOTHER; -+ goto out_err; - } - - if (errno == ENOENT) { - ret = cg_mkdir_p(curr->path); -- if (ret) -- return ret; -+ if (ret) { -+ error = ret; -+ goto out_err; -+ } - } else if (!S_ISDIR(buff.st_mode)) { - errno = ENOTDIR; - last_errno = errno; -- return ECGOTHER; -+ error = ECGOTHER; -+ goto out_err; - } - - ret = mount(CGROUP_FILESYSTEM, curr->path, CGROUP_FILESYSTEM, - 0, curr->name); - -- if (ret < 0) -- return ECGMOUNTFAIL; -+ if (ret < 0) { -+ error = ECGMOUNTFAIL; -+ goto out_err; -+ } - } - return 0; -+out_err: -+ /* -+ * If we come here, we have failed. Since we have touched only -+ * mountpoints prior to i, we shall operate on only them now. -+ */ -+ config_table_index = 1; -+ return error; - } - - /* -@@ -681,24 +695,25 @@ int cgroup_config_load_config(const char - mount_enabled = (config_mount_table[0].name[0] != '\0'); - - /* -- * The configuration should have either namespace or mount. -- * Not both and not none. -+ * The configuration should have namespace or mount, not both. - */ -- if (namespace_enabled == mount_enabled) { -+ if (namespace_enabled && mount_enabled) { - free(config_cgroup_table); - return ECGMOUNTNAMESPACE; - } - -- /* -- * We do not allow both mount and namespace sections in the -- * same configuration file. So test for that -- */ -- - error = cgroup_config_mount_fs(); - if (error) - goto err_mnt; - - error = cgroup_init(); -+ if (error == ECGROUPNOTMOUNTED && cgroup_table_index == 0) { -+ /* -+ * The config file seems to be empty. -+ */ -+ error = 0; -+ goto err_mnt; -+ } - if (error) - goto err_mnt; - diff --git a/libcgroup-group-write.patch b/libcgroup-group-write.patch deleted file mode 100644 index 39775b0..0000000 --- a/libcgroup-group-write.patch +++ /dev/null @@ -1,168 +0,0 @@ -diff -ur libcgroup-0.37/doc/man/cgconfig.conf.5 libcgroup-0.37-mode/doc/man/cgconfig.conf.5 ---- libcgroup-0.37/doc/man/cgconfig.conf.5 2010-12-07 16:42:41.000000000 +0100 -+++ libcgroup-0.37-mode/doc/man/cgconfig.conf.5 2011-02-09 19:11:47.076601002 +0100 -@@ -111,12 +111,15 @@ - .ft B - uid = ; - gid = ; -+mode = ; - .RE - } - admin { - .RS - uid = ; - gid = ; -+dmode = ; -+fmode = ; - .RE - } - .RE -@@ -133,10 +136,19 @@ - file of the control group. I.e. this user and members of this - group has write access to the file. - .TP 17 -+.B "task mode" -+Permission mode of \fItasks\fR file of the control group. -+The mode have to be set using octal numbers e.g. 640. -+.TP 17 - .B "admin user/group" - Name of the user and the group, which owns the rest of control group's - files. These users are allowed to set subsystem - parameters and create subgroups. -+.TP 17 -+.B "admin dmode/fmode" -+Permission mode of control group's directory (\fIdmode\fR) and files -+(\fIfmode\fR). The mode have to be set using octal numbers e.g. 775 -+for \fIdmode\fR and 664 for \fIfmode\fR. - .LP - Permissions are related only to enclosing control group and are not - inherited by subgroups. If there is no -diff -ur libcgroup-0.37/src/api.c libcgroup-0.37-mode/src/api.c ---- libcgroup-0.37/src/api.c 2010-12-07 16:42:41.000000000 +0100 -+++ libcgroup-0.37-mode/src/api.c 2011-02-09 18:57:25.455591513 +0100 -@@ -1409,6 +1409,10 @@ - cgroup_dbg("Changing ownership of %s\n", fts_path[0]); - error = cg_chown_recursive(fts_path, - cgroup->control_uid, cgroup->control_gid); -+ if (!error) -+ error = cg_chmod_recursive(cgroup, -+ cgroup->control_dmode, cgroup->control_dmode, -+ cgroup->control_fmode, cgroup->control_fmode); - } - - if (error) -@@ -1458,6 +1462,13 @@ - if (error) { - last_errno = errno; - error = ECGOTHER; -+ goto err; -+ } -+ if (cgroup->tasks_mode != 0) -+ error = chmod(path, cgroup->tasks_mode); -+ if (error) { -+ last_errno = errno; -+ error = ECGOTHER; - goto err; - } - } -diff -ur libcgroup-0.37/src/config.c libcgroup-0.37-mode/src/config.c ---- libcgroup-0.37/src/config.c 2010-12-07 16:42:41.000000000 +0100 -+++ libcgroup-0.37-mode/src/config.c 2011-02-09 18:59:15.330591502 +0100 -@@ -226,6 +226,29 @@ - } - config_cgroup->tasks_gid = val; - } -+ if (!strcmp(perm_type, "mode")) { -+ /* allowed mode strings are octal version: "755" */ -+ mode_t mode = 0; -+ int pos = 0; /* position of the number iin string */ -+ int i; -+ int j = 64; -+ -+ while (pos < 3) { -+ if (value[pos] < '0' || value[pos] >= '8') -+ goto group_task_error; -+ i = (int)value[pos] - (int)'0'; -+ /* parse the permission triple*/ -+ mode = mode + i*j; -+ j = j / 8; -+ pos++; -+ } -+ -+ /* the string have to contain three characters */ -+ if (value[pos] != '\0') -+ goto group_task_error; -+ -+ config_cgroup->tasks_mode = mode; -+ } - - free(perm_type); - free(value); -@@ -292,6 +315,52 @@ - } - config_cgroup->control_gid = val; - } -+ if (!strcmp(perm_type, "dmode")) { -+ /* allowed mode strings are octal version: "755" */ -+ mode_t mode = 0; -+ int pos = 0; /* position of the number iin string */ -+ int i; -+ int j = 64; -+ -+ while (pos < 3) { -+ if (value[pos] < '0' || value[pos] >= '8') -+ goto admin_error; -+ i = (int)value[pos] - (int)'0'; -+ /* parse the permission triple*/ -+ mode = mode + i*j; -+ j = j / 8; -+ pos++; -+ } -+ -+ /* the string have to contain three characters */ -+ if (value[pos] != '\0') -+ goto admin_error; -+ -+ config_cgroup->control_dmode = mode; -+ } -+ if (!strcmp(perm_type, "fmode")) { -+ /* allowed mode strings are octal version: "755" */ -+ mode_t mode = 0; -+ int pos = 0; /* position of the number iin string */ -+ int i; -+ int j = 64; -+ -+ while (pos < 3) { -+ if (value[pos] < '0' || value[pos] >= '8') -+ goto admin_error; -+ i = (int)value[pos] - (int)'0'; -+ /* parse the permission triple*/ -+ mode = mode + i*j; -+ j = j / 8; -+ pos++; -+ } -+ -+ /* the string have to contain three characters */ -+ if (value[pos] != '\0') -+ goto admin_error; -+ -+ config_cgroup->control_fmode = mode; -+ } - - free(perm_type); - free(value); -diff -ur libcgroup-0.37/src/libcgroup-internal.h libcgroup-0.37-mode/src/libcgroup-internal.h ---- libcgroup-0.37/src/libcgroup-internal.h 2010-10-20 15:59:13.000000000 +0200 -+++ libcgroup-0.37-mode/src/libcgroup-internal.h 2011-02-09 19:14:13.803601030 +0100 -@@ -84,8 +84,11 @@ - int index; - uid_t tasks_uid; - gid_t tasks_gid; -+ mode_t tasks_mode; - uid_t control_uid; - gid_t control_gid; -+ mode_t control_dmode; -+ mode_t control_fmode; - }; - - diff --git a/libcgroup.spec b/libcgroup.spec index ef4056e..ccf8811 100644 --- a/libcgroup.spec +++ b/libcgroup.spec @@ -1,19 +1,20 @@ +%define _rc rc1 Summary: Tools and library to control and monitor control groups Summary(pl.UTF-8): Narzędzia i biblioteka do kontrolowania i monitorowania grup kontroli Name: libcgroup -Version: 0.37.1 -Release: 4 +Version: 0.38 +Release: 0.%{_rc}.1 License: LGPL v2+ Group: Libraries -Source0: http://downloads.sourceforge.net/libcg/%{name}-%{version}.tar.bz2 -# Source0-md5: 24a41b18de112e8d085bb1f7d9e82af7 +Source0: http://downloads.sourceforge.net/libcg/%{name}-%{version}.%{_rc}.tar.bz2 +# Source0-md5: 6c2100af9840f54f8bf97836887a4517 Source1: cgconfig.init Source2: cgred.init +Source3: cgconfig.service +Source4: cgred.service +Source5: cgred.sysconfig Patch0: %{name}-pam.patch -Patch1: %{name}-group-write.patch -Patch2: %{name}-conf.patch -Patch3: libcgroup-0.36.2-systemd.patch -Patch4: libcgroup-0.37.1-systemd.patch +Patch1: %{name}-conf.patch URL: http://libcg.sourceforge.net/ BuildRequires: autoconf BuildRequires: automake @@ -22,6 +23,7 @@ BuildRequires: flex BuildRequires: libstdc++-devel BuildRequires: libtool BuildRequires: pam-devel +BuildRequires: rpmbuild(macros) >= 1.626 Requires(post): /sbin/ldconfig Requires(post,preun): /sbin/chkconfig Requires(postun): /usr/sbin/groupdel @@ -29,6 +31,7 @@ Requires(pre): /usr/bin/getgid Requires(pre): /usr/sbin/groupadd Requires: procps Requires: rc-scripts +Requires: systemd-units >= 37-0.10 Provides: group(cgred) BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) @@ -76,12 +79,9 @@ PAM module for libcgroup. Moduł PAM dla libcgroup. %prep -%setup -q +%setup -q -n %{name}-%{version}.%{_rc} %patch0 -p1 %patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 %build %{__libtoolize} @@ -91,13 +91,14 @@ Moduł PAM dla libcgroup. %configure \ --disable-silent-rules \ --enable-initscript-install \ - --enable-pam-module-dir=/%{_lib}/security + --enable-pam-module-dir=/%{_lib}/security \ + --enable-opaque-hierarchy="name=systemd" %{__make} %install rm -rf $RPM_BUILD_ROOT -install -d $RPM_BUILD_ROOT/etc/sysconfig +install -d $RPM_BUILD_ROOT{/etc/sysconfig,%{systemdunitdir}} %{__make} install \ DESTDIR=$RPM_BUILD_ROOT @@ -105,8 +106,10 @@ install -d $RPM_BUILD_ROOT/etc/sysconfig install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/cgconfig install %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/cgred -cp -a samples/cgred.conf $RPM_BUILD_ROOT/etc/sysconfig/cgred.conf -cp -a samples/cgconfig.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/cgconfig +install %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/cgconfig.service +install %{SOURCE4} $RPM_BUILD_ROOT%{systemdunitdir}/cgred.service + +install %{SOURCE5} $RPM_BUILD_ROOT/etc/sysconfig/cgred cp -a samples/cg{config,rules,snapshot_blacklist}.conf $RPM_BUILD_ROOT%{_sysconfdir} mv $RPM_BUILD_ROOT%{_libdir}/libcgroup.so.* $RPM_BUILD_ROOT/%{_lib} @@ -131,6 +134,9 @@ fi if [ ! -f /var/lock/subsys/cgred ]; then echo 'Run "/sbin/service cgred start" to start control group rules daemon.' fi +NORESTART=1 +%systemd_post cgconfig.service +%systemd_post cgred.service %preun if [ $1 = 0 ]; then @@ -139,21 +145,49 @@ if [ $1 = 0 ]; then /sbin/chkconfig --del cgconfig /sbin/chkconfig --del cgred fi +%systemd_preun cgconfig.service +%systemd_preun cgred.service %postun /sbin/ldconfig if [ "$1" = "0" ]; then %groupremove cgred fi +%systemd_reload + +%triggerpostun -- %{name} < 0.38-0.rc1.1 +if [ -f /etc/sysconfig/cgred.conf.rpmsave ]; then + . /etc/sysconfig/cgred.conf.rpmsave + OPTIONS= + [ -n "$NODAEMON" ] && OPTIONS="$OPTIONS $NODAEMON" + [ -n "$LOG" ] && OPTIONS="$OPTIONS $LOG" + if [ -n "$LOG_FILE" ]; then + OPTIONS="$OPTIONS -f $LOG_FILE" + else + OPTIONS="$OPTIONS -s" + fi + [ -n "$SOCKET_USER" ] && OPTIONS="$OPTIONS -u $SOCKET_USER" + if [ -n "$SOCKET_GROUP" ]; then + OPTIONS="$OPTIONS -g $SOCKET_GROUP" + else + OPTIONS="$OPTIONS -g cgred" + fi + echo >>/etc/sysconfig/cgred + echo "# Added by rpm trigger" >>/etc/sysconfig/cgred + echo "OPTIONS=\"$OPTIONS\"" >>/etc/sysconfig/cgred +fi +%systemd_trigger cgconfig.service +%systemd_trigger cgred.service %files %defattr(644,root,root,755) %doc README README_daemon %attr(754,root,root) /etc/rc.d/init.d/cgconfig %attr(754,root,root) /etc/rc.d/init.d/cgred -%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cgconfig -%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cgred.conf +%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cgred %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/cg*.conf +%{systemdunitdir}/cgconfig.service +%{systemdunitdir}/cgred.service %attr(755,root,root) /%{_lib}/libcgroup.so.*.*.* %attr(755,root,root) %ghost /%{_lib}/libcgroup.so.1 %attr(755,root,root) /bin/cgclassify -- 2.43.0