summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2013-09-16 15:47:17 -0300
committerNicolás Reynolds <fauno@endefensadelsl.org>2013-09-16 15:47:17 -0300
commit04a644a60c39e019dc410a34a6bfc34d6500d907 (patch)
treefdf26cb08e9d6b62cb9ce4091c33cb6ad051a7ec
parent7549e3194e86dfe09d7490e27af49b09ee4f64b6 (diff)
libcgroup: manage linux cgroups
-rw-r--r--pcr/libcgroup/PKGBUILD57
-rw-r--r--pcr/libcgroup/cgconfig.service17
-rw-r--r--pcr/libcgroup/cgrules.service16
-rw-r--r--pcr/libcgroup/libcgroup.install11
4 files changed, 101 insertions, 0 deletions
diff --git a/pcr/libcgroup/PKGBUILD b/pcr/libcgroup/PKGBUILD
new file mode 100644
index 000000000..849a5c128
--- /dev/null
+++ b/pcr/libcgroup/PKGBUILD
@@ -0,0 +1,57 @@
+# Maintainer: Christian Hesse <mail@eworm.de>
+# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
+
+pkgname=libcgroup
+pkgver=0.40rc1
+pkgrel=1
+pkgdesc="Library that abstracts the control group file system in Linux"
+arch=('i686' 'x86_64')
+url="http://libcg.sourceforge.net"
+license=(LGPL)
+backup=('etc/cgconfig.conf'
+ 'etc/cgrules.conf'
+ 'etc/cgsnapshot_blacklist.conf')
+options=('!emptydirs' '!libtool')
+install=libcgroup.install
+source=("http://downloads.sourceforge.net/libcg/${pkgname}-${pkgver/rc/.rc}.tar.bz2"
+ 'cgconfig.service'
+ 'cgrules.service')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver/rc/.rc}"
+
+ ./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --sbindir=/usr/bin \
+ --enable-opaque-hierarchy=name=systemd
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver/rc/.rc}"
+
+ make DESTDIR="${pkgdir}" pkgconfigdir="/usr/lib/pkgconfig" install
+
+ install -D -m0644 samples/cgconfig.conf "${pkgdir}/etc/cgconfig.conf"
+ install -D -m0644 samples/cgrules.conf "${pkgdir}/etc/cgrules.conf"
+ install -D -m0644 samples/cgsnapshot_blacklist.conf "${pkgdir}/etc/cgsnapshot_blacklist.conf"
+
+ install -D -m0644 ${srcdir}/cgconfig.service "${pkgdir}/usr/lib/systemd/system/cgconfig.service"
+ install -D -m0644 ${srcdir}/cgrules.service "${pkgdir}/usr/lib/systemd/system/cgrules.service"
+
+ rm -f ${pkgdir}/usr/lib/security/pam_cgroup.{la,so,so.0}
+ mv ${pkgdir}/usr/lib/security/pam_cgroup.so.0.0.0 ${pkgdir}/usr/lib/security/pam_cgroup.so
+
+ rm -rf ${pkgdir}/etc/rc.d
+
+ # Make cgexec setgid cgred
+ chown root:160 ${pkgdir}/usr/bin/cgexec
+ chmod 2755 ${pkgdir}/usr/bin/cgexec
+}
+
+sha256sums=('c2fa2cfdfd1023093afb6de456fc3ac000f92a2f01b905bcdda1c3e36ad44072'
+ '808fc354abf36d7b6673dad790be275309ac57a2606d1be3732b9b3aeb5885eb'
+ '6b1340ff6717f55e5e57dacc72accc0bfaed7e50ef31439271b6ddc893cbf671')
diff --git a/pcr/libcgroup/cgconfig.service b/pcr/libcgroup/cgconfig.service
new file mode 100644
index 000000000..3e6689d77
--- /dev/null
+++ b/pcr/libcgroup/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/bin/cgconfigparser -l /etc/cgconfig.conf -s 1664
+ExecStop=/usr/bin/cgclear -l /etc/cgconfig.conf -e
+
+[Install]
+WantedBy=sysinit.target
diff --git a/pcr/libcgroup/cgrules.service b/pcr/libcgroup/cgrules.service
new file mode 100644
index 000000000..cd0bf34fb
--- /dev/null
+++ b/pcr/libcgroup/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/bin/cgrulesengd -n -f -
+
+[Install]
+WantedBy=sysinit.target
diff --git a/pcr/libcgroup/libcgroup.install b/pcr/libcgroup/libcgroup.install
new file mode 100644
index 000000000..a78216add
--- /dev/null
+++ b/pcr/libcgroup/libcgroup.install
@@ -0,0 +1,11 @@
+post_install() {
+ getent group cgred &>/dev/null || groupadd -r -g 160 cgred >/dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+post_remove() {
+ getent group cgred &>/dev/null && groupdel cgred >/dev/null
+}