summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-11-16 18:09:14 -0500
committerAnthony G. Basile <blueness@gentoo.org>2015-11-16 18:09:33 -0500
commita8cc51c8c561a5b98aa079858de05b2b869b6e76 (patch)
treefffc7a0e5dbd49cf130990deaf75c9bda3ef63f5 /dev-libs/libcgroup
parentUpdate gnome 3.18 mask (diff)
downloadgentoo-a8cc51c8c561a5b98aa079858de05b2b869b6e76.tar.gz
gentoo-a8cc51c8c561a5b98aa079858de05b2b869b6e76.tar.bz2
gentoo-a8cc51c8c561a5b98aa079858de05b2b869b6e76.zip
dev-libs/libcgroup: refactor the init scripts.
Thanks tokiclover@eclipso.email Package-Manager: portage-2.2.20.1
Diffstat (limited to 'dev-libs/libcgroup')
-rw-r--r--dev-libs/libcgroup/files/cgconfig.confd-r17
-rw-r--r--dev-libs/libcgroup/files/cgconfig.initd-r153
-rw-r--r--dev-libs/libcgroup/files/cgred.confd-r15
-rw-r--r--dev-libs/libcgroup/files/cgred.initd-r124
-rw-r--r--dev-libs/libcgroup/libcgroup-0.41-r3.ebuild92
5 files changed, 181 insertions, 0 deletions
diff --git a/dev-libs/libcgroup/files/cgconfig.confd-r1 b/dev-libs/libcgroup/files/cgconfig.confd-r1
new file mode 100644
index 000000000000..334958ef3b8f
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgconfig.confd-r1
@@ -0,0 +1,7 @@
+# /etc/conf.d/cgconfig: config file for /etc/init.d/cgconfig
+
+# Configuration file location
+CG_CONFIGFILE=/etc/cgroup/cgconfig.conf
+
+# Enable calssifying pid according to rules if necessary
+CG_CLASSIFY=No
diff --git a/dev-libs/libcgroup/files/cgconfig.initd-r1 b/dev-libs/libcgroup/files/cgconfig.initd-r1
new file mode 100644
index 000000000000..f10d994162c4
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgconfig.initd-r1
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /etc/init.d/cgconfig,v 1.1 2015/02/18 09:53:59 tokiclover Exp $
+
+CGCONFIGPARSER="/usr/sbin/cgconfigparser"
+CGCLASSIFY="/usr/sbin/cgclassify"
+: ${CG_CONFIGFILE:=/etc/cgroup/cgconfig.conf}
+description="Control Group Configuration Service"
+
+start()
+{
+ ebegin "Setting up CGroups"
+ ${CGCONFIGPARSER} --load=${CG_CONFIGFILE} >/dev/null 2>&1
+ eend "$?"
+}
+
+start_post()
+{
+ # Classify PID according to the rules if requested
+ yesno "${CG_CLASSIFY}" || return 0
+ ebegin "Classifying PID to CGroups"
+ local pid
+ for pid in $(ps --no-headers -eL o tid); do
+ ${CGCLASSIFY} ${pid}
+ done
+ eend "$?"
+}
+
+stop()
+{
+ cgconfig_umount
+}
+
+cgconfig_umount()
+{
+ local ctrl eq mnt_pnt mnt_pts
+
+ while read ctrl eq mnt_pnt; do
+ case "${ctrl}" in
+ (\#*) continue ;;
+ (mount*) mnt_pts=true;;
+ (\}*) mnt_pts= ;;
+ (*)
+ [ -n "${mnt_pts}" ] || continue
+ mnt_pnt="${mnt_pnt%;}"
+ ebegin "Unmounting ${mnt_pnt}"
+ umount "${mnt_pnt}"
+ eend "$?"
+ ;;
+ esac
+ done < "${CG_CONFIGFILE}"
+}
diff --git a/dev-libs/libcgroup/files/cgred.confd-r1 b/dev-libs/libcgroup/files/cgred.confd-r1
new file mode 100644
index 000000000000..e351434afa69
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgred.confd-r1
@@ -0,0 +1,5 @@
+# /etc/conf.d/cgred.conf: config file for /etc/init.d/cgred
+
+# Options to pass to cgrulesengd;
+# See the cgrulesengd(8) man page for more info.
+CGRED_OPTS=""
diff --git a/dev-libs/libcgroup/files/cgred.initd-r1 b/dev-libs/libcgroup/files/cgred.initd-r1
new file mode 100644
index 000000000000..85cbb05931e9
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgred.initd-r1
@@ -0,0 +1,24 @@
+#!/sbin/runscript
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /etc/init.d/cgred,v 1.1 2015/02/14 09:53:59 tokiclover Exp $
+
+command="/usr/sbin/cgrulesengd"
+command_args="${CGRED_OPTS}"
+command_background="1"
+pidfile="/var/run/cgred.pid"
+description="CGroups Rules Engine Daemon"
+extra_started_commands="reload"
+
+depend()
+{
+ need cgconfig
+ use logger
+}
+
+reload()
+{
+ ebegin "Reloading CGroup Rules Engine Daemon"
+ kill -USR2 $(cat "${pidfile}")
+ eend $?
+}
diff --git a/dev-libs/libcgroup/libcgroup-0.41-r3.ebuild b/dev-libs/libcgroup/libcgroup-0.41-r3.ebuild
new file mode 100644
index 000000000000..23304adfaabf
--- /dev/null
+++ b/dev-libs/libcgroup/libcgroup-0.41-r3.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit autotools eutils flag-o-matic linux-info pam
+
+DESCRIPTION="Tools and libraries to configure and manage kernel control groups"
+HOMEPAGE="http://libcg.sourceforge.net/"
+SRC_URI="mirror://sourceforge/project/libcg/${PN}/v${PV}/${P}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE="+daemon elibc_musl debug pam static-libs +tools"
+
+RDEPEND="pam? ( virtual/pam )"
+
+DEPEND="
+ ${RDEPEND}
+ sys-devel/bison
+ sys-devel/flex
+ elibc_musl? ( sys-libs/fts-standalone )
+ "
+REQUIRED_USE="daemon? ( tools )"
+
+DOCS=(README_daemon README README_systemd INSTALL)
+pkg_setup() {
+ local CONFIG_CHECK="~CGROUPS"
+ if use daemon; then
+ CONFIG_CHECK="${CONFIG_CHECK} ~CONNECTOR ~PROC_EVENTS"
+ fi
+ linux-info_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-replace_DECLS.patch
+ epatch "${FILESDIR}"/${P}-replace_INLCUDES.patch
+ epatch "${FILESDIR}"/${P}-reorder-headers.patch
+
+ # Change rules file location
+ sed -e 's:/etc/cgrules.conf:/etc/cgroup/cgrules.conf:' \
+ -i src/libcgroup-internal.h || die "sed failed"
+ sed -e 's:\(pam_cgroup_la_LDFLAGS.*\):\1\ -avoid-version:' \
+ -i src/pam/Makefile.am || die "sed failed"
+ sed -e 's#/var/run#/run#g' -i configure.in || die "sed failed"
+
+ eautoreconf
+}
+
+src_configure() {
+ local my_conf
+
+ if use pam; then
+ my_conf=" --enable-pam-module-dir=$(getpam_mod_dir) "
+ fi
+
+ use elibc_musl && append-ldflags "-lfts"
+ econf \
+ $(use_enable static-libs static) \
+ $(use_enable daemon) \
+ $(use_enable debug) \
+ $(use_enable pam) \
+ $(use_enable tools) \
+ ${my_conf}
+}
+
+src_test() {
+ # Use mount cgroup to build directory
+ # sandbox restricted to trivial build,
+ # possible kill Diego tanderbox ;)
+ true
+}
+
+src_install() {
+ default
+ prune_libtool_files --all
+
+ insinto /etc/cgroup
+ doins samples/*.conf || die
+
+ if use tools; then
+ newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig || die
+ newinitd "${FILESDIR}"/cgconfig.initd-r1 cgconfig || die
+ fi
+
+ if use daemon; then
+ newconfd "${FILESDIR}"/cgred.confd-r1 cgred || die
+ newinitd "${FILESDIR}"/cgred.initd-r1 cgred || die
+ fi
+}