summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernardo Meurer <meurerbernardo@gmail.com>2019-08-09 00:00:22 -0700
committerMichał Górny <mgorny@gentoo.org>2019-09-21 11:15:20 +0200
commit4de83263b965d169ff6e1a42b3238f543633256c (patch)
treeae46da9fc257c21e1ddccae13ffff18cd54cc80c /dev-libs/libcgroup
parentkde-plasma: Drop KDE Plasma 5.15.5 (diff)
downloadgentoo-4de83263b965d169ff6e1a42b3238f543633256c.tar.gz
gentoo-4de83263b965d169ff6e1a42b3238f543633256c.tar.bz2
gentoo-4de83263b965d169ff6e1a42b3238f543633256c.zip
dev-libs/libcgroup: add systemd unit files
Closes: https://bugs.gentoo.org/632204 Package-Manager: Portage-2.3.71, Repoman-2.3.17 Signed-off-by: Bernardo Meurer <bernardo@standard.ai> Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-libs/libcgroup')
-rw-r--r--dev-libs/libcgroup/files/cgconfig.service17
-rw-r--r--dev-libs/libcgroup/files/cgrules.service16
-rw-r--r--dev-libs/libcgroup/libcgroup-0.41-r6.ebuild103
3 files changed, 136 insertions, 0 deletions
diff --git a/dev-libs/libcgroup/files/cgconfig.service b/dev-libs/libcgroup/files/cgconfig.service
new file mode 100644
index 000000000000..d2948ff825b7
--- /dev/null
+++ b/dev-libs/libcgroup/files/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=/usr/sbin/cgconfigparser -l /etc/cgroup/cgconfig.conf -s 1664
+ExecStop=/usr/sbin/cgclear -l /etc/cgroup/cgconfig.conf -e
+
+[Install]
+WantedBy=sysinit.target
diff --git a/dev-libs/libcgroup/files/cgrules.service b/dev-libs/libcgroup/files/cgrules.service
new file mode 100644
index 000000000000..2c6426bf9520
--- /dev/null
+++ b/dev-libs/libcgroup/files/cgrules.service
@@ -0,0 +1,16 @@
+[Unit]
+Description=Control Group rules 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
+After=cgconfig.service
+
+[Service]
+Type=simple
+ExecStart=/usr/sbin/cgrulesengd -n -f -
+
+[Install]
+WantedBy=sysinit.target
diff --git a/dev-libs/libcgroup/libcgroup-0.41-r6.ebuild b/dev-libs/libcgroup/libcgroup-0.41-r6.ebuild
new file mode 100644
index 000000000000..14021a85a767
--- /dev/null
+++ b/dev-libs/libcgroup/libcgroup-0.41-r6.ebuild
@@ -0,0 +1,103 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic linux-info pam systemd
+
+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 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+IUSE="+daemon elibc_musl pam static-libs test +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
+}
+
+PATCHES=(
+ "${FILESDIR}"/${P}-replace_DECLS.patch
+ "${FILESDIR}"/${P}-replace_INLCUDES.patch
+ "${FILESDIR}"/${P}-reorder-headers.patch
+ "${FILESDIR}"/${P}-remove-umask.patch
+)
+
+src_prepare() {
+ default
+ # 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:/etc/cgconfig.conf:/etc/cgroup/cgconfig.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"
+
+ # If we're not running tests, don't bother building them.
+ if ! use test; then
+ sed -i '/^SUBDIRS/s:tests::' Makefile.am || die
+ fi
+
+ 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 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
+
+ if use tools; then
+ newconfd "${FILESDIR}"/cgconfig.confd-r1 cgconfig
+ newinitd "${FILESDIR}"/cgconfig.initd-r1 cgconfig
+ systemd_dounit "${FILESDIR}"/cgconfig.service
+ systemd_dounit "${FILESDIR}"/cgrules.service
+ fi
+
+ if use daemon; then
+ newconfd "${FILESDIR}"/cgred.confd-r2 cgred
+ newinitd "${FILESDIR}"/cgred.initd-r1 cgred
+ fi
+}