Browse Source

a/libcgroup: Added libcgroup-0.41.g62f7665.

current-20200608
Damien Goutte-Gattat 10 months ago
parent
commit
1b67706c3c
6 changed files with 361 additions and 0 deletions
  1. +43
    -0
      a/libcgroup/doinst.sh
  2. +8
    -0
      a/libcgroup/libcgroup-0.41-fix-conf-name.diff
  3. +136
    -0
      a/libcgroup/libcgroup-0.41-fix-redhatisms.diff
  4. +1
    -0
      a/libcgroup/libcgroup-0.41.g62f7665.tar.gz.sha256
  5. +161
    -0
      a/libcgroup/libcgroup.SlackBuild
  6. +12
    -0
      a/libcgroup/slack-desc

+ 43
- 0
a/libcgroup/doinst.sh View File

@ -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

+ 8
- 0
a/libcgroup/libcgroup-0.41-fix-conf-name.diff View File

@ -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

+ 136
- 0
a/libcgroup/libcgroup-0.41-fix-redhatisms.diff View File

@ -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
}

+ 1
- 0
a/libcgroup/libcgroup-0.41.g62f7665.tar.gz.sha256 View File

@ -0,0 +1 @@
fd0607e6479e47c69b189ffccd4a9ea1a5e61482f6dce43348015f2747b6da9c libcgroup-0.41.g62f7665.tar.gz

+ 161
- 0
a/libcgroup/libcgroup.SlackBuild View File

@ -0,0 +1,161 @@
#!/bin/bash
# Build script for Slackware
# Copyright (C) 2020 Damien Goutte-Gattat
# Copyright (C) 2011,2014,2017,2018 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modifications,
# 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.
#
# Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
#
# Latest libcgroup sourcecode is available at:
# <https://sourceforge.net/projects/libcg>.
#
# Note: This Slackbuild is intended to upgrade the libcgroup-0.41
# package provided by Slackware-current as of 2020/06/08.
# Source package infos
NAMESRC=${NAMESRC:-libcgroup}
VERSION=${VERSION:-0.41.g62f7665}
ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
REPO=${REPO:-https://git.code.sf.net/p/libcg/libcg}
COMMIT=${COMMIT:-62f76650db84c0a25f76ece3a79d9d16a1e9f931}
# Build infos
NAMEPKG=${NAMEPKG:-libcgroup}
BUILD=${BUILD:-1GGD}
ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
EXT=${EXT:-txz}
NAME=$NAMEPKG-$VERSION
# Directories
TMP=${TMP:-/tmp}
OUT=${OUT:-$TMP/build}
PKG=${PKG:-$OUT/$NAMEPKG}
CWD=$(pwd)
set -e # Quit if a command returns non-zero
# Sanity checks
if [ $UID -eq 0 ]; then
echo "You should NOT run this script as ROOT!"
exit 1
fi
if [ ! -d $TMP ]; then
echo "$TMP does not exists or is not a directory!"
exit 1
fi
# Compilation flags
LIBDIRSUFFIX=""
case "$ARCH" in
i?86)
CPUOPT="-O2 -march=$ARCH -mtune=i686"
;;
x86_64)
CPUOPT="-O2 -fPIC"
LIBDIRSUFFIX="64"
;;
*)
CPUOPT="-O2"
;;
esac
# Get and verify the source archive
if [ ! -r $ARCHIVE ]; then
git clone $REPO libcgroup
(cd libcgroup
git archive --prefix=$NAME/ $COMMIT | gzip -c > ../$ARCHIVE
)
rm -rf libcgroup
fi
sha256sum -c $ARCHIVE.sha256
# Compile
cd $TMP
echo "Building $ARCHIVE..."
tar xf $CWD/$ARCHIVE
cd $NAME
# Remove Red Hat / LSB init-scriptisms
patch -p 1 < $CWD/libcgroup-0.41-fix-redhatisms.diff
# Fix pathname of config script
patch -p 1 < $CWD/libcgroup-0.41-fix-conf-name.diff
autoreconf -vif
CFLAGS=$CPUOPT \
CXXFLAGS=$CPUOPT \
./configure \
--prefix=/usr \
--libdir=/usr/lib$LIBDIRSUFFIX \
--sysconfdir=/etc \
--mandir=/usr/man \
--infodir=/usr/info \
--docdir=/usr/doc/$NAME \
--enable-pam \
--enable-pam-module-dir=/lib$LIBDIRSUFFIX/security \
--disable-dependency-tracking \
--build=$ARCH-slackware-linux
make
make install-strip DESTDIR=$PKG
# Don't ship .la files
rm -f $PKG/{,usr}/lib$LIBDIRSUFFIX/*.la $PKG/lib$LIBDIRSUFFIX/security/*.la
# This directory is needed by cgrulesengd
mkdir -p $PKG/etc/cgconfig.d
# Install init scripts
mkdir -p $PKG/etc/rc.d
install -m 644 scripts/init.d/cgconfig $PKG/etc/rc.d/rc.cgconfig.new
install -m 644 scripts/init.d/cgred $PKG/etc/rc.d/rc.cgred.new
# Compress man pages
find $PKG/usr/man -type f -exec gzip -9 {} \;
# Install the documentation
mkdir -p $PKG/usr/doc/$NAME
install -m 644 COPYING README README_daemon $PKG/usr/doc/$NAME
# Install sample config files
mkdir -p $PKG/usr/doc/$NAME/samples
(cd samples
for conffile in cgconfig.conf cgred.conf cgrules.conf cgsnapshot_blacklist.conf ; do
install -m 644 $conffile $PKG/etc/$conffile.new
install -m 644 $conffile $PKG/usr/doc/$NAME/samples/$conffile
done)
# Copy slack-desc and doinst.sh files
install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
install -m 755 $CWD/doinst.sh $PKG/install/doinst.sh
# Package the tree
cd $PKG
mkdir -p $OUT
PACKAGING="
chown root:root . -R
chown root:cgred usr/bin/cgexec
chmod 2755 usr/bin/cgexec
/sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
rm -rf $PKG
rm -rf $TMP/$NAME
"
if type -p fakeroot ; then
echo "$PACKAGING" | fakeroot
else
su -c "$PACKAGING"
fi

+ 12
- 0
a/libcgroup/slack-desc View File

@ -0,0 +1,12 @@
|-----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:

Loading…
Cancel
Save