packages: libcgroup/cgconfig.init, libcgroup/cgred.init, libcgroup/libcgrou...

baggins baggins at pld-linux.org
Mon Feb 13 21:03:10 CET 2012


Author: baggins                      Date: Mon Feb 13 20:03:10 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- 0.38.rc1
- removed obsolete patches
- added systemd support
- drop support for default cgroup creation
- simplified cgred sysconfig file

---- Files affected:
packages/libcgroup:
   cgconfig.init (1.9 -> 1.10) , cgred.init (1.14 -> 1.15) , libcgroup.spec (1.25 -> 1.26) , cgconfig.service (NONE -> 1.1)  (NEW), cgred.service (NONE -> 1.1)  (NEW), cgred.sysconfig (NONE -> 1.1)  (NEW), libcgroup-0.36.2-systemd.patch (1.1 -> NONE)  (REMOVED), libcgroup-0.37.1-systemd.patch (1.1 -> NONE)  (REMOVED), libcgroup-group-write.patch (1.2 -> NONE)  (REMOVED)

---- Diffs:

================================================================
Index: packages/libcgroup/cgconfig.init
diff -u packages/libcgroup/cgconfig.init:1.9 packages/libcgroup/cgconfig.init:1.10
--- packages/libcgroup/cgconfig.init:1.9	Tue Apr  5 22:21:27 2011
+++ packages/libcgroup/cgconfig.init	Mon Feb 13 21:03:04 2012
@@ -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 @@
 		exit $RETVAL
 	fi
 
-	if is_yes "$CREATE_DEFAULT"; then
-		create_default_groups
-	fi
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/cgconfig
 	ok

================================================================
Index: packages/libcgroup/cgred.init
diff -u packages/libcgroup/cgred.init:1.14 packages/libcgroup/cgred.init:1.15
--- packages/libcgroup/cgred.init:1.14	Tue Apr  5 21:31:03 2011
+++ packages/libcgroup/cgred.init	Mon Feb 13 21:03:04 2012
@@ -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 @@
 	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=$?

================================================================
Index: packages/libcgroup/libcgroup.spec
diff -u packages/libcgroup/libcgroup.spec:1.25 packages/libcgroup/libcgroup.spec:1.26
--- packages/libcgroup/libcgroup.spec:1.25	Sun Jan 29 12:05:59 2012
+++ packages/libcgroup/libcgroup.spec	Mon Feb 13 21:03:04 2012
@@ -1,20 +1,21 @@
 # $Revision$, $Date$
+%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
@@ -23,6 +24,7 @@
 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
@@ -30,6 +32,7 @@
 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)
 
@@ -77,12 +80,9 @@
 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}
@@ -92,13 +92,14 @@
 %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
@@ -106,8 +107,10 @@
 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}
@@ -132,6 +135,9 @@
 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
@@ -140,21 +146,49 @@
 	/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
@@ -191,6 +225,13 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.26  2012/02/13 20:03:04  baggins
+- 0.38.rc1
+- removed obsolete patches
+- added systemd support
+- drop support for default cgroup creation
+- simplified cgred sysconfig file
+
 Revision 1.25  2012/01/29 11:05:59  arekm
 - rel 4; updated mountpoint by don't mount by default (leve it for admin)
 

================================================================
Index: packages/libcgroup/cgconfig.service
diff -u /dev/null packages/libcgroup/cgconfig.service:1.1
--- /dev/null	Mon Feb 13 21:03:10 2012
+++ packages/libcgroup/cgconfig.service	Mon Feb 13 21:03:04 2012
@@ -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

================================================================
Index: packages/libcgroup/cgred.service
diff -u /dev/null packages/libcgroup/cgred.service:1.1
--- /dev/null	Mon Feb 13 21:03:10 2012
+++ packages/libcgroup/cgred.service	Mon Feb 13 21:03:04 2012
@@ -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

================================================================
Index: packages/libcgroup/cgred.sysconfig
diff -u /dev/null packages/libcgroup/cgred.sysconfig:1.1
--- /dev/null	Mon Feb 13 21:03:10 2012
+++ packages/libcgroup/cgred.sysconfig	Mon Feb 13 21:03:04 2012
@@ -0,0 +1,2 @@
+# cgrulesengd command line options. See cgrulesengd(8).
+OPTIONS="-s -g cgred"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libcgroup/cgconfig.init?r1=1.9&r2=1.10&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libcgroup/cgred.init?r1=1.14&r2=1.15&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/libcgroup/libcgroup.spec?r1=1.25&r2=1.26&f=u



More information about the pld-cvs-commit mailing list