Commit f3b0d427 authored by Seblu's avatar Seblu
Browse files

Remove libcgroup

parent 215d5bcd
Loading
Loading
Loading
Loading

libcgroup/PKGBUILD

deleted100644 → 0
+0 −56
Original line number Diff line number Diff line
# $Id$
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>

pkgname=libcgroup
pkgver=0.38
pkgrel=0.1
pkgdesc='Library and tools 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')
options=('!emptydirs' '!libtool')
install=libcgroup.install
source=("http://downloads.sourceforge.net/libcg/$pkgname-$pkgver.tar.bz2"
        'cgred.rc'
        'cgconfig.rc')
md5sums=('f0f7d4060bf36ccc19d75dbf4f1695db'
         '72abd2fd52853579b91e1ca6ea87197a'
         '8e2ee870398dd62d3c4730330bbf6c21')

build() {
  cd $pkgname-$pkgver
  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" pkgconfigdir=/usr/lib/pkgconfig install
  # install samples
  install -Dm644 samples/cgconfig.sysconfig "$pkgdir/etc/conf.d/cgconfig"
  install -Dm644 samples/cgred.conf "$pkgdir/etc/conf.d/cgred"
  install -Dm644 samples/cgconfig.conf "$pkgdir/etc/cgconfig.conf"
  install -Dm644 samples/cgrules.conf "$pkgdir/etc/cgrules.conf"
  install -Dm644 samples/cgsnapshot_blacklist.conf "$pkgdir/etc/cgsnapshot_blacklist.conf"
  # fix naming of pam library
  cd "$pkgdir/usr/lib/security"
  mv pam_cgroup.so.0.0.0 pam_cgroup.so
  rm -vf pam_cgroup.so.*
  # install custom initscripts
  cd "$pkgdir"
  install -Dm755 "$srcdir/cgred.rc" etc/rc.d/cgred
  install -Dm755 "$srcdir/cgconfig.rc" etc/rc.d/cgconfig
  # Make cgexec setgid cgred
  #chown root:160 usr/bin/cgexec
  #chmod 2755 usr/bin/cgexec
}

# vim:set ts=2 sw=2 et:

libcgroup/cgconfig.rc

deleted100644 → 0
+0 −80
Original line number Diff line number Diff line
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

CREATE_DEFAULT=yes
. /etc/conf.d/cgconfig

# From cgconfig init.d script
create_default_groups() {
  local defaultcgroup

  if [[ -f /etc/cgrules.conf ]]; then
    defaultcgroup=$(grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf|awk '{print $3}')
  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 -f 664 -d 775 -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'
    if cgconfigparser -l /etc/cgconfig.conf; then
      [[ "$CREATE_DEFAULT" == yes ]] && create_default_groups
      add_daemon ${0##*/}
      stat_done
    else
      stat_fail
    fi
    ;;
  stop)
    status 'Clearing CGroups configuration' cgclear && rm_daemon ${0##*/}
    ;;
  restart)
    $0 stop
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac

# vim:set ts=2 sw=2 ft=sh et:

libcgroup/cgred.rc

deleted100644 → 0
+0 −53
Original line number Diff line number Diff line
#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

. /etc/conf.d/cgred
OPTIONS="$NODAEMON $LOG"
if [ -n "$LOG_FILE" ]; then
  OPTIONS="$OPTIONS --logfile=$LOG_FILE"
fi
if [ -n "$SOCKET_USER" ]; then
  OPTIONS="$OPTIONS -u $SOCKET_USER"
fi
if [ -n "$SOCKET_GROUP" ]; then
  OPTIONS="$OPTIONS -g $SOCKET_GROUP"
fi

PID=`pidof -o %PPID /usr/sbin/cgrulesengd`
case "$1" in
  start)
    stat_busy "Starting CGroups rules engine daemon"
    if [ -z "$PID" ]; then 
      # Load Connector support
      modprobe cn
      sleep 0.1
      cgrulesengd $OPTIONS
    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
    $0 start
    ;;
  *)
    echo "usage: $0 {start|stop|restart}"  
esac

# vim:set ts=2 sw=2 ft=sh et:

libcgroup/libcgroup.install

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
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
}