Permalink
Browse files

initial commit

  • Loading branch information...
falconindy committed May 1, 2010
1 parent c90e51b commit 90776c6ef448bf89e0e97877cb616692d475f290
Showing with 252 additions and 0 deletions.
  1. +68 −0 libcgroup-git/PKGBUILD
  2. +98 −0 libcgroup-git/cgconfig
  3. +45 −0 libcgroup-git/cgred
  4. +41 −0 systemd-git/PKGBUILD
View
@@ -0,0 +1,68 @@
+# Maintainer: Jan "heftig" Steffens <jan.steffens@student.kit.edu>
+
+pkgname=libcgroup-git
+pkgver=20100501
+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/conf.d/cgred etc/conf.d/cgconfig etc/cgconfig.conf etc/cgrules.conf)
+source=(cgconfig cgred)
+provides=('libcgroup')
+md5sums=('54e64c0eaa4eafcef947d3824dc82bbb'
+ 'ccc0891adbd8863dc11b7bcc339f22d5')
+
+_gitroot="git://libcg.git.sourceforge.net/gitroot/libcg/libcg"
+_gitname="libcg"
+
+build() {
+ cd "$srcdir"
+ msg "Connecting to GIT server...."
+
+ if [ -d $_gitname ] ; then
+ cd $_gitname && git pull origin
+ msg "The local files are updated."
+ else
+ git clone $_gitroot $_gitname
+ fi
+
+ msg "GIT checkout done or server timeout"
+ msg "Starting make..."
+
+ rm -rf "$srcdir/$_gitname-build"
+ git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
+ cd "$srcdir/$_gitname-build"
+
+ aclocal
+ libtoolize -c
+ autoconf
+ autoheader
+ automake --foreign --add-missing --copy
+
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+
+ make clean
+ make
+}
+
+package() {
+ cd "$srcdir/$_gitname-build"
+
+ make DESTDIR="$pkgdir" install
+
+ install -Dm644 samples/cgred.conf "$pkgdir/etc/conf.d/cgred"
+ install -Dm644 samples/cgconfig.sysconfig "$pkgdir/etc/conf.d/cgconfig"
+ install -Dm644 samples/cgconfig.conf "$pkgdir/etc/cgconfig.conf"
+ install -Dm644 samples/cgrules.conf "$pkgdir/etc/cgrules.conf"
+
+ cd "$pkgdir"
+
+ mkdir -p lib/security
+ mv usr/lib/pam_cgroup.so.*.*.* lib/security/pam_cgroup.so
+ rm -f usr/lib/pam_cgroup*
+
+ rm -rf etc/rc.d
+ install -Dm755 "$srcdir/cgred" etc/rc.d/cgred
+ install -Dm755 "$srcdir/cgconfig" etc/rc.d/cgconfig
+}
View
@@ -0,0 +1,98 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/conf.d/cgconfig
+
+# From cgconfig init.d script
+create_default_groups() {
+ declare defaultcgroup
+
+ if [ -f /etc/cgrules.conf ]
+ then
+ read user ctrl defaultcgroup <<< \
+ $(grep -m1 ^\* /etc/cgrules.conf)
+ if [[ -n $defaultcgroup && $defaultcgroup = "*" ]]
+ then
+ 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 | tr '\n' ',' | sed s/.$//)
+
+ #
+ # Create the default group, ignore errors when the default group
+ # already exists.
+ #
+ cgcreate -g $controllers:$defaultcgroup 2>/dev/null
+
+ #
+ # special rule for cpusets
+ #
+ if echo $controllers | grep -q -w cpuset; then
+ 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
+
+ #
+ # special rule for cpus
+ #
+ if echo $controllers | grep -q -w cpu; then
+ rt_runtime_us=$(cgget -nv -r cpu.rt_runtime_us /)
+ cgset -r cpu.rt_runtime_us=$rt_runtime_us $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 || :
+}
+
+case "$1" in
+ start)
+ stat_busy "Starting CGroups configuration"
+ /usr/sbin/cgconfigparser -l /etc/cgconfig.conf
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ if [ $CREATE_DEFAULT == "yes" ]; then
+ create_default_groups
+ fi
+ add_daemon cgconfig
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Clearing CGroups configuration"
+ cgclear
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon cgconfig
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+# vim:set ft=sh:
View
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/conf.d/cgred
+
+if [ -n "$LOG_FILE" ]; then
+ LOG_FILE="--log-file=$LOG_FILE"
+fi
+
+PID=`pidof -o %PPID /usr/sbin/cgrulesengd`
+case "$1" in
+ start)
+ stat_busy "Starting CGroups rules engine daemon"
+ if [ -z "$PID" ]; then
+ /usr/sbin/cgrulesengd $LOG $LOG_FILE
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon cgred
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping CGroups rules engine daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon cgred
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+
+# vim:set ft=sh:
View
@@ -0,0 +1,41 @@
+# Contributor: Your Name <youremail@domain.com>
+pkgname=systemd-git
+pkgver=20100501
+pkgrel=1
+pkgdesc="systems Session and Startup manager"
+arch=('i686' 'x86_64')
+url="http://0pointer.de/blog/projects/systemd.html"
+license=('GPL')
+depends=('libgee' 'libcgroup-git')
+makedepends=('git' 'vala')
+backup=('etc/dbus-1/systemd/org.freedesktop.systemd1.conf')
+
+_gitroot="git://git.0pointer.de/systemd.git"
+_gitname="systemd"
+
+build() {
+ cd "$srcdir"
+ msg "Connecting to GIT server...."
+
+ if [ -d $_gitname ] ; then
+ cd $_gitname && git pull origin
+ msg "The local files are updated."
+ else
+ git clone $_gitroot $_gitname
+ fi
+
+ msg "GIT checkout done or server timeout"
+ msg "Starting make..."
+
+ rm -rf "$srcdir/$_gitname-build"
+ git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
+ cd "$srcdir/$_gitname-build"
+
+ ./bootstrap.sh --prefix=/usr --with-distro=none || return 1
+ make || return 1
+}
+
+package() {
+ cd "$srcdir/$_gitname-build"
+ make DESTDIR="$pkgdir" install || return 1
+}

0 comments on commit 90776c6

Please sign in to comment.