diff options
Diffstat (limited to 'source/a/libcgroup')
-rw-r--r-- | source/a/libcgroup/doinst.sh | 43 | ||||
-rwxr-xr-x | source/a/libcgroup/libcgroup.SlackBuild | 163 | ||||
-rw-r--r-- | source/a/libcgroup/libcgroup.conf.diff | 8 | ||||
-rw-r--r-- | source/a/libcgroup/libcgroup.init.diff | 133 | ||||
-rw-r--r-- | source/a/libcgroup/slack-desc | 19 |
5 files changed, 366 insertions, 0 deletions
diff --git a/source/a/libcgroup/doinst.sh b/source/a/libcgroup/doinst.sh new file mode 100644 index 00000000..0799f0d9 --- /dev/null +++ b/source/a/libcgroup/doinst.sh @@ -0,0 +1,43 @@ +#!/bin/sh +config() { + NEW="$1" + OLD="`dirname $NEW`/`basename $NEW .new`" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Leave any new rc files with the same permissions as the old ones: +if [ -e etc/rc.d/rc.cgconfig ]; then + if [ -x etc/rc.d/rc.cgconfig ]; then + chmod 755 etc/rc.d/rc.cgconfig.new + else + chmod 644 etc/rc.d/rc.cgconfig.new + fi +fi +if [ -e etc/rc.d/rc.cgred ]; then + if [ -x etc/rc.d/rc.cgred ]; then + chmod 755 etc/rc.d/rc.cgred.new + else + chmod 644 etc/rc.d/rc.cgred.new + fi +fi + +# Then config() them: +config etc/rc.d/rc.cgconfig.new +config etc/rc.d/rc.cgred.new + +# config() the other configuration files: +config etc/cgconfig.conf.new +config etc/cgred.conf.new +config etc/cgrules.conf.new +config etc/cgsnapshot_blacklist.conf.new + +# If there are already installed config files, get rid of the .new ones. +# There will still be fresh samples in the docs. +rm -f etc/cgconfig.conf.new etc/cgred.conf.new etc/cgrules.conf.new etc/cgsnapshot_blacklist.conf.new + diff --git a/source/a/libcgroup/libcgroup.SlackBuild b/source/a/libcgroup/libcgroup.SlackBuild new file mode 100755 index 00000000..286a7fa2 --- /dev/null +++ b/source/a/libcgroup/libcgroup.SlackBuild @@ -0,0 +1,163 @@ +#!/bin/sh + +# Copyright 2011 Patrick J. Volkerding, Sebeka, Minnesota, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +PKGNAM=libcgroup +VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} +BUILD=${BUILD:-1} + +# Automatically determine the architecture we're building on: +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + # Unless $ARCH is already set, use uname -m for all other archs: + *) export ARCH=$( uname -m ) ;; + esac +fi + +NUMJOBS=${NUMJOBS:-" -j7 "} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp} +PKG=$TMP/package-$PKGNAM + +rm -rf $PKG +mkdir -p $TMP $PKG + +cd $TMP +rm -rf $PKGNAM-$VERSION +tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1 +cd $PKGNAM-$VERSION + +# Remove Red Hat / LSB init-scriptisms: +zcat $CWD/libcgroup.init.diff.gz | patch -p1 --verbose || exit 1 + +# Slackware does not use /etc/sysconfig: +zcat $CWD/libcgroup.conf.diff.gz | patch -p1 --verbose || exit 1 + +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# Configure: +CFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --disable-pam \ + --disable-static \ + --build=$ARCH-slackware-linux + +# Build and install: +make $NUMJOBS || make || exit 1 +make install DESTDIR=$PKG || exit 1 + +# If this directory is empty, do not include it in the package: +rmdir $PKG/usr/lib${LIBDIRSUFFIX}/security 2> /dev/null + +# Install init scripts: +mkdir -p $PKG/etc/rc.d +cp -a scripts/init.d/cgconfig $PKG/etc/rc.d/rc.cgconfig.new +cp -a scripts/init.d/cgred $PKG/etc/rc.d/rc.cgred.new +chmod 644 $PKG/etc/rc.d/* +chown -R root:root $PKG/etc/rc.d/* + +# Install sample config files: +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION/samples +( cd samples + for conffile in cgconfig.conf cgred.conf cgrules.conf cgsnapshot_blacklist.conf ; do + cp -a $conffile $PKG/etc/${conffile}.new + cp -a $conffile $PKG/usr/doc/${PKGNAM}-$VERSION/samples + done +) + +# Strip binaries: +( cd $PKG + find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +) + +# Add a documentation directory: +mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION +cp -a \ + AUTHORS COPYING* INSTALL NEWS README* THANKS TODO \ + $PKG/usr/doc/${PKGNAM}-$VERSION + +# Compress and if needed symlink the man pages: +if [ -d $PKG/usr/man ]; then + ( cd $PKG/usr/man + for manpagedir in $(find . -type d -name "man*") ; do + ( cd $manpagedir + for eachpage in $( find . -type l -maxdepth 1) ; do + ln -s $( readlink $eachpage ).gz $eachpage.gz + rm $eachpage + done + gzip -9 *.? + ) + done + ) +fi + +# Compress info files, if any: +if [ -d $PKG/usr/info ]; then + ( cd $PKG/usr/info + rm -f dir + gzip -9 * + ) +fi + +# If there's a ChangeLog, installing at least part of the recent history +# is useful, but don't let it get totally out of control: +if [ -r ChangeLog ]; then + DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION) + cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog + touch -r ChangeLog $DOCSDIR/ChangeLog +fi + +mkdir -p $PKG/install +zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz + diff --git a/source/a/libcgroup/libcgroup.conf.diff b/source/a/libcgroup/libcgroup.conf.diff new file mode 100644 index 00000000..f6e9dd10 --- /dev/null +++ b/source/a/libcgroup/libcgroup.conf.diff @@ -0,0 +1,8 @@ +--- ./samples/cgred.conf.orig 2011-01-10 14:16:09.750002388 -0600 ++++ ./samples/cgred.conf 2011-01-10 14:16:20.446998061 -0600 +@@ -1,4 +1,4 @@ +-# /etc/sysconfig/cgred.conf - CGroup Rules Engine Daemon configuration file ++# /etc/cgred.conf - CGroup Rules Engine Daemon configuration file + # + # The four options listed below (CONFIG_FILE, LOG_FILE, NODAEMON, LOG) are + # the only valid ones. Defining anything else in this file will cause the diff --git a/source/a/libcgroup/libcgroup.init.diff b/source/a/libcgroup/libcgroup.init.diff new file mode 100644 index 00000000..75491295 --- /dev/null +++ b/source/a/libcgroup/libcgroup.init.diff @@ -0,0 +1,133 @@ +--- ./scripts/init.d/cgred.in.orig 2011-03-03 02:29:41.000000000 -0600 ++++ ./scripts/init.d/cgred.in 2011-03-03 14:23:03.000000000 -0600 +@@ -39,9 +39,8 @@ + # Sanity checks + [ -x $CGRED_BIN ] || exit 1 + +-# Source function library & LSB routines ++# Source function library + . /etc/rc.d/init.d/functions +-. /lib/lsb/init-functions + + # Read in configuration options. + if [ -f "/etc/sysconfig/cgred.conf" ] ; then +@@ -70,16 +69,16 @@ + { + echo -n $"Starting CGroup Rules Engine Daemon: " + if [ -f "$lockfile" ]; then +- log_failure_msg "$servicename is already running with PID `cat ${pidfile}`" ++ echo "$servicename is already running with PID `cat ${pidfile}`" + return 0 + fi + if [ ! -s $CGRED_CONF ]; then +- log_failure_msg "not configured" ++ echo "not configured" + return 6 + fi + if ! grep "^cgroup" /proc/mounts &>/dev/null; then + echo +- log_failure_msg $"Cannot find cgroups, is cgconfig service running?" ++ echo $"Cannot find cgroups, is cgconfig service running?" + return 1 + fi + daemon --check $servicename --pidfile $pidfile $CGRED_BIN $OPTIONS +@@ -100,7 +99,7 @@ + { + echo -n $"Stopping CGroup Rules Engine Daemon..." + if [ ! -f $pidfile ]; then +- log_success_msg ++ #log_success_msg + return 0 + fi + killproc -p $pidfile -TERM "$processname" +@@ -146,13 +145,13 @@ + echo $"Reloading rules configuration..." + kill -s 12 `cat ${pidfile}` + RETVAL=$? +- if [ $RETVAL -eq 0 ] ; then +- log_success_msg +- else +- log_failure_msg +- fi ++ #if [ $RETVAL -eq 0 ] ; then ++ # log_success_msg ++ #else ++ # log_failure_msg ++ #fi + else +- log_failure_msg "$servicename is not running." ++ echo "$servicename is not running." + fi + ;; + *) +--- ./scripts/init.d/cgconfig.in.orig 2011-03-03 02:29:41.000000000 -0600 ++++ ./scripts/init.d/cgconfig.in 2011-03-03 14:21:27.000000000 -0600 +@@ -36,11 +36,6 @@ + servicename=cgconfig + lockfile=/var/lock/subsys/$servicename + +-# +-# Source LSB routines +-# +-. /lib/lsb/init-functions +- + # read the config + CREATE_DEFAULT=yes + if [ -e /etc/sysconfig/cgconfig ]; then +@@ -54,8 +49,8 @@ + grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf | \ + read user ctrl defaultcgroup + if [ -n "$defaultcgroup" -a "$defaultcgroup" = "*" ]; then +- log_warning_msg "/etc/cgrules.conf incorrect" +- log_warning_msg "Overriding it" ++ echo "/etc/cgrules.conf incorrect" ++ echo "Overriding it" + defaultcgroup= + fi + fi +@@ -98,20 +93,20 @@ + start() { + echo -n "Starting cgconfig service: " + if [ -f "$lockfile" ]; then +- log_warning_msg "lock file already exists" ++ echo "lock file already exists" + return 0 + fi + + if [ $? -eq 0 ]; then + if [ ! -s $CONFIG_FILE ]; then +- log_failure_msg $CONFIG_FILE "is not configured" ++ echo $CONFIG_FILE "is not configured" + return 6 + fi + + $CGCONFIGPARSER_BIN -l $CONFIG_FILE + retval=$? + if [ $retval -ne 0 ]; then +- log_failure_msg "Failed to parse " $CONFIG_FILE ++ echo "Failed to parse " $CONFIG_FILE + return 1 + fi + fi +@@ -123,10 +118,10 @@ + touch "$lockfile" + retval=$? + if [ $retval -ne 0 ]; then +- log_failure_msg "Failed to touch $lockfile" ++ echo "Failed to touch $lockfile" + return 1 + fi +- log_success_msg ++ #log_success_msg + return 0 + } + +@@ -134,7 +129,7 @@ + echo -n "Stopping cgconfig service: " + cgclear + rm -f "$lockfile" +- log_success_msg ++ #log_success_msg + return 0 + } + diff --git a/source/a/libcgroup/slack-desc b/source/a/libcgroup/slack-desc new file mode 100644 index 00000000..30a43ebe --- /dev/null +++ b/source/a/libcgroup/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' +# on the right side marks the last column you can put a character in. You must +# make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':'. + + |-----handy-ruler-------------------------------------------------------| +libcgroup: libcgroup (library and utilities for kernel control groups) +libcgroup: +libcgroup: Control Groups provide a mechanism for aggregating/partitioning sets of +libcgroup: tasks, and all their future children, into hierarchical groups with +libcgroup: specialized behaviour. It makes use of a filesystem interface. +libcgroup: This package contains a library for developing applications that use +libcgroup: control groups, as well as some basic userspace tools for controlling +libcgroup: and monitoring control groups. +libcgroup: +libcgroup: Homepage: http://libcg.sourceforge.net/ +libcgroup: |