summaryrefslogtreecommitdiff
path: root/patches/source/libcgroup
diff options
context:
space:
mode:
Diffstat (limited to 'patches/source/libcgroup')
-rw-r--r--patches/source/libcgroup/doinst.sh43
-rwxr-xr-xpatches/source/libcgroup/libcgroup.SlackBuild171
-rw-r--r--patches/source/libcgroup/libcgroup.conf.diff8
-rw-r--r--patches/source/libcgroup/libcgroup.init.diff136
-rw-r--r--patches/source/libcgroup/slack-desc19
5 files changed, 377 insertions, 0 deletions
diff --git a/patches/source/libcgroup/doinst.sh b/patches/source/libcgroup/doinst.sh
new file mode 100644
index 00000000..0799f0d9
--- /dev/null
+++ b/patches/source/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/patches/source/libcgroup/libcgroup.SlackBuild b/patches/source/libcgroup/libcgroup.SlackBuild
new file mode 100755
index 00000000..61d27b33
--- /dev/null
+++ b/patches/source/libcgroup/libcgroup.SlackBuild
@@ -0,0 +1,171 @@
+#!/bin/sh
+
+# Copyright 2011, 2014, 2017 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:-2_slack14.2}
+
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) export ARCH=i586 ;;
+ 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" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -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 || exit 1
+
+# 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
+
+## COMMENTED OUT FOR 14.2 PACKAGE BUGFIX SINCE IT WOULD REQUIRE A NEW GROUP:
+## cgexec doesn't need to be setuid root -- setgid cgred is sufficient:
+#chown root:cgred $PKG/usr/bin/cgexec
+#chmod 2755 $PKG/usr/bin/cgexec
+
+# 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
+)
+
+## DON'T TRY TO USE cgred GROUP, IT DOESN'T EXIST ON 14.2:
+sed -i "s/SOCKET_GROUP=\"cgred\"/SOCKET_GROUP=\"\"/g" $PKG/etc/cgred.conf.new
+
+# 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/patches/source/libcgroup/libcgroup.conf.diff b/patches/source/libcgroup/libcgroup.conf.diff
new file mode 100644
index 00000000..f6e9dd10
--- /dev/null
+++ b/patches/source/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/patches/source/libcgroup/libcgroup.init.diff b/patches/source/libcgroup/libcgroup.init.diff
new file mode 100644
index 00000000..1d1be2cc
--- /dev/null
+++ b/patches/source/libcgroup/libcgroup.init.diff
@@ -0,0 +1,136 @@
+--- ./scripts/init.d/cgred.in.orig 2014-01-13 08:05:56.000000000 -0600
++++ ./scripts/init.d/cgred.in 2017-02-28 12:41:11.307424565 -0600
+@@ -39,13 +39,12 @@
+ # 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
+- . /etc/sysconfig/cgred.conf
++if [ -f /etc/cgred.conf ] ; then
++ . /etc/cgred.conf
+ OPTIONS="$NODAEMON $LOG"
+ if [ -n "$LOG_FILE" ]; then
+ OPTIONS="$OPTIONS --logfile=$LOG_FILE"
+@@ -70,13 +69,13 @@
+ {
+ 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
+ num=`grep "cgroup" /proc/mounts | awk '$3=="cgroup"' | wc -l`
+ if [ $num -eq 0 ]; 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
+@@ -97,7 +96,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"
+@@ -143,13 +142,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 2014-01-13 08:05:56.000000000 -0600
++++ ./scripts/init.d/cgconfig.in 2017-02-28 12:42:13.278423245 -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 @@
+ read user ctrl defaultcgroup <<< \
+ $(grep -m1 '^\*[[:space:]]\+' /etc/cgrules.conf)
+ 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,18 +118,18 @@
+ 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
+ }
+
+ stop() {
+ echo -n "Stopping cgconfig service: "
+- cgclear
++ /usr/sbin/cgclear -l /etc/cgconfig.conf
+ rm -f "$lockfile"
+- log_success_msg
++ #log_success_msg
+ return 0
+ }
+
diff --git a/patches/source/libcgroup/slack-desc b/patches/source/libcgroup/slack-desc
new file mode 100644
index 00000000..30a43ebe
--- /dev/null
+++ b/patches/source/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: