summaryrefslogtreecommitdiff
path: root/source/ap/cgmanager
diff options
context:
space:
mode:
authorPatrick J Volkerding <volkerdi@slackware.com>2016-06-30 20:26:57 +0000
committerEric Hameleers <alien@slackware.com>2018-05-31 23:31:18 +0200
commitd31c50870d0bee042ce660e445c9294a59a3a65b (patch)
tree6bfc0de3c95267b401b620c2c67859557dc60f97 /source/ap/cgmanager
parent76fc4757ac91ac7947a01fb7b53dddf9a78a01d1 (diff)
downloadcurrent-d31c50870d0bee042ce660e445c9294a59a3a65b.tar.gz
Slackware 14.2slackware-14.2
Thu Jun 30 20:26:57 UTC 2016 Slackware 14.2 x86_64 stable is released! The long development cycle (the Linux community has lately been living in "interesting times", as they say) is finally behind us, and we're proud to announce the release of Slackware 14.2. The new release brings many updates and modern tools, has switched from udev to eudev (no systemd), and adds well over a hundred new packages to the system. Thanks to the team, the upstream developers, the dedicated Slackware community, and everyone else who pitched in to help make this release a reality. The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a dual-sided 32-bit/64-bit x86/x86_64 DVD. Please consider supporting the Slackware project by picking up a copy from store.slackware.com. We're taking pre-orders now, and offer a discount if you sign up for a subscription. Have fun! :-)
Diffstat (limited to 'source/ap/cgmanager')
-rw-r--r--source/ap/cgmanager/cgmanager-0.39-remove-pam-requirement.patch76
-rwxr-xr-xsource/ap/cgmanager/cgmanager.SlackBuild154
-rw-r--r--source/ap/cgmanager/cgmanager.url1
-rw-r--r--source/ap/cgmanager/config/rc.cgmanager56
-rw-r--r--source/ap/cgmanager/config/rc.cgproxy58
-rw-r--r--source/ap/cgmanager/doinst.sh27
-rw-r--r--source/ap/cgmanager/slack-desc19
7 files changed, 391 insertions, 0 deletions
diff --git a/source/ap/cgmanager/cgmanager-0.39-remove-pam-requirement.patch b/source/ap/cgmanager/cgmanager-0.39-remove-pam-requirement.patch
new file mode 100644
index 00000000..412e4d56
--- /dev/null
+++ b/source/ap/cgmanager/cgmanager-0.39-remove-pam-requirement.patch
@@ -0,0 +1,76 @@
+diff -Nur cgmanager-0.39.orig/Makefile.in cgmanager-0.39/Makefile.in
+--- cgmanager-0.39.orig/Makefile.in 2015-09-03 17:59:13.000000000 -0500
++++ cgmanager-0.39/Makefile.in 2015-11-19 19:48:33.407492836 -0600
+@@ -503,15 +503,6 @@
+ libcgmanager_la_LIBADD = \
+ $(DBUS_LIBS) $(NIH_LIBS) $(NIH_DBUS_LIBS)
+
+-pam_LTLIBRARIES = pam_cgm.la
+-pam_cgm_la_SOURCES = pam/pam_cgm.c pam/cgmanager.c pam/cgmanager.h
+-pam_cgm_la_CFLAGS = $(AM_CFLAGS)
+-pam_cgm_la_LIBADD = $(AM_LIBS) $(PAM_LIBS) -L$(top_srcdir) -lcgmanager
+-pam_cgm_la_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared
+-pam_cgm_la_DEPENDENCIES = libcgmanager.la
+-all: $(BUILT_SOURCES) config.h
+- $(MAKE) $(AM_MAKEFLAGS) all-recursive
+-
+ .SUFFIXES:
+ .SUFFIXES: .c .lo .o .obj
+ am--refresh: Makefile
+diff -Nur cgmanager-0.39.orig/configure cgmanager-0.39/configure
+--- cgmanager-0.39.orig/configure 2015-09-03 17:59:14.000000000 -0500
++++ cgmanager-0.39/configure 2015-11-19 19:48:08.425776320 -0600
+@@ -13401,53 +13401,6 @@
+
+
+
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pam_authenticate in -lpam" >&5
+-$as_echo_n "checking for pam_authenticate in -lpam... " >&6; }
+-if ${ac_cv_lib_pam_pam_authenticate+:} false; then :
+- $as_echo_n "(cached) " >&6
+-else
+- ac_check_lib_save_LIBS=$LIBS
+-LIBS="-lpam $LIBS"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h. */
+-
+-/* Override any GCC internal prototype to avoid an error.
+- Use char because int might match the return type of a GCC
+- builtin and then its argument prototype would still apply. */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char pam_authenticate ();
+-int
+-main ()
+-{
+-return pam_authenticate ();
+- ;
+- return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+- ac_cv_lib_pam_pam_authenticate=yes
+-else
+- ac_cv_lib_pam_pam_authenticate=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext \
+- conftest$ac_exeext conftest.$ac_ext
+-LIBS=$ac_check_lib_save_LIBS
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pam_pam_authenticate" >&5
+-$as_echo "$ac_cv_lib_pam_pam_authenticate" >&6; }
+-if test "x$ac_cv_lib_pam_pam_authenticate" = xyes; then :
+- PAM_LIBS="-lpam"
+-else
+- as_fn_error $? "*** libpam not found." "$LINENO" 5
+-
+-fi
+-
+-
+-
+-
+-
+ cat >confcache <<\_ACEOF
+ # This file is a shell script that caches the results of configure
+ # tests run on this system so they can be shared between configure
diff --git a/source/ap/cgmanager/cgmanager.SlackBuild b/source/ap/cgmanager/cgmanager.SlackBuild
new file mode 100755
index 00000000..d5862eaa
--- /dev/null
+++ b/source/ap/cgmanager/cgmanager.SlackBuild
@@ -0,0 +1,154 @@
+#!/bin/sh
+
+# Copyright 2014, 2015 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.
+
+# Modified by Matteo Bernardini <ponce@slackbuilds.org> (2014)
+
+PKGNAM=cgmanager
+VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | rev | cut -f 2- -d -)}
+BUILD=${BUILD:-1}
+
+# 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 || 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 {} \;
+
+zcat $CWD/cgmanager-0.39-remove-pam-requirement.patch.gz | patch -p1 || exit 1
+
+# Configure:
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PKGNAM-$VERSION \
+ --infodir=/usr/info \
+ --enable-static=no \
+ --with-distro=slackware \
+ --build=$ARCH-slackware-linux
+
+# Build and install:
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Remove .la files:
+rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.la
+
+# 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 init scripts
+mkdir -p $PKG/etc/rc.d
+cat $CWD/config/rc.cgmanager > $PKG/etc/rc.d/rc.cgmanager.new
+cat $CWD/config/rc.cgproxy > $PKG/etc/rc.d/rc.cgproxy.new
+
+# Run cgmanager by default:
+chmod 755 $PKG/etc/rc.d/rc.cgmanager.new
+
+# Make this executable by default as well, so that "rc.cgmanager start" will
+# start cgproxy in a container:
+chmod 755 $PKG/etc/rc.d/rc.cgproxy.new
+
+# No need for these in the package:
+rm -rf $PKG/usr/share/cgmanager/tests
+rmdir --parents $PKG/usr/share/cgmanager 2>/dev/null
+
+# Add a documentation directory:
+mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
+cp -a \
+ AUTHORS CONTRIBUTING COPYING* MAINTAINERS NEWS README* 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
+
+# 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
+cat $CWD/slack-desc > $PKG/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/ap/cgmanager/cgmanager.url b/source/ap/cgmanager/cgmanager.url
new file mode 100644
index 00000000..3bfd1a37
--- /dev/null
+++ b/source/ap/cgmanager/cgmanager.url
@@ -0,0 +1 @@
+https://linuxcontainers.org/cgmanager/downloads/
diff --git a/source/ap/cgmanager/config/rc.cgmanager b/source/ap/cgmanager/config/rc.cgmanager
new file mode 100644
index 00000000..83c19061
--- /dev/null
+++ b/source/ap/cgmanager/config/rc.cgmanager
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# /etc/rc.d/rc.cgmanager - start/stop the cgroup manager
+
+if [ -f /etc/default/cgmanager ]; then
+ # get cgmanager options if specified
+ . /etc/default/cgmanager
+fi
+
+start_cgmanager() {
+ # Kill any existing cgproxy
+ /bin/sh /etc/rc.d/rc.cgproxy stop >/dev/null 2>&1 || true
+ # check whether to start cgproxy or cgmanager
+ if /usr/sbin/cgproxy --check-master; then
+ if [ -x /etc/rc.d/rc.cgproxy -a ! -r /run/cgmanager.pid ]; then
+ NESTED=yes /etc/rc.d/rc.cgproxy start || true && { exit 0; }
+ else
+ # If we are here, either cgmanager is already running (in which case
+ # we don't want to run it again), or rc.cgproxy is not executable
+ # (in which case we don't want to run it).
+ echo "Error: rc.cgproxy is not executable, or attempting to start multiple instances of cgmanager"
+ exit 1
+ fi
+ fi
+ echo "Starting cgmanager: /usr/sbin/cgmanager --daemon"
+ /usr/sbin/cgmanager --daemon
+}
+
+stop_cgmanager() {
+ # If the cgmanager stops, the proxy must also stop
+ /bin/sh /etc/rc.d/rc.cgproxy stop >/dev/null 2>&1 || true
+ echo "Stopping cgmanager."
+ /bin/kill $(cat /run/cgmanager.pid 2>/dev/null) 2>/dev/null
+ /usr/bin/pkill cgmanager 2>/dev/null
+ rm -f /run/cgmanager.pid
+}
+
+restart_cgmanager() {
+ stop_cgmanager
+ sleep 1
+ start_cgmanager
+}
+
+case "$1" in
+'start')
+ start_cgmanager
+ ;;
+'stop')
+ stop_cgmanager
+ ;;
+'restart')
+ restart_cgmanager
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
diff --git a/source/ap/cgmanager/config/rc.cgproxy b/source/ap/cgmanager/config/rc.cgproxy
new file mode 100644
index 00000000..bd96902c
--- /dev/null
+++ b/source/ap/cgmanager/config/rc.cgproxy
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# /etc/rc.d/rc.cgproxy - start/stop the cgroup proxy manager
+
+if [ -f /etc/default/cgproxy ]; then
+ # get cgproxy options if specified
+ . /etc/default/cgproxy
+fi
+
+start_cgproxy() {
+ # cgproxy should only run on container unless on older kernel
+ if [ -e /proc/self/ns/pid ] && [ "$NESTED" != "yes" ]; then
+ echo "Error: cgproxy should only run inside containers"
+ exit 0
+ fi
+ echo "Starting cgproxy: /usr/sbin/cgproxy --daemon"
+ /usr/sbin/cgproxy --daemon
+}
+
+stop_cgproxy() {
+ if ps -C cgproxy | grep -q cgproxy 2>/dev/null ; then
+ echo "Stopping cgproxy."
+ if ! /bin/kill $(cat /run/cgproxy.pid 2>/dev/null) 2>/dev/null ; then
+ sleep 1
+ echo "Sending cgproxy the TERM signal."
+ if ! /usr/bin/pkill -TERM cgproxy ; then
+ sleep 5
+ echo "Sending cgproxy the KILL signal."
+ /usr/bin/pkill -KILL cgproxy
+ sleep 5
+ if ps -C cgproxy | grep -q cgproxy 2>/dev/null ; then
+ echo "Error: couldn't stop cgproxy."
+ fi
+ fi
+ fi
+ rm -f /run/cgproxy.pid
+ fi
+}
+
+restart_cgproxy() {
+ stop_cgproxy
+ sleep 1
+ start_cgproxy
+}
+
+case "$1" in
+'start')
+ start_cgproxy
+ ;;
+'stop')
+ stop_cgproxy
+ ;;
+'restart')
+ restart_cgproxy
+ ;;
+*)
+ echo "usage $0 start|stop|restart"
+esac
diff --git a/source/ap/cgmanager/doinst.sh b/source/ap/cgmanager/doinst.sh
new file mode 100644
index 00000000..e12ae79e
--- /dev/null
+++ b/source/ap/cgmanager/doinst.sh
@@ -0,0 +1,27 @@
+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...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.cgmanager.new
+preserve_perms etc/rc.d/rc.cgproxy.new
+
diff --git a/source/ap/cgmanager/slack-desc b/source/ap/cgmanager/slack-desc
new file mode 100644
index 00000000..89d4122f
--- /dev/null
+++ b/source/ap/cgmanager/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------------------------------------------------------|
+cgmanager: cgmanager (Control Group manager daemons)
+cgmanager:
+cgmanager: CGManager manages all your cgroups for you through a simple DBus API.
+cgmanager: It's designed to work with nested LXC containers as well as accepting
+cgmanager: unprivileged requests including resolving user namespaces UIDs/GIDs.
+cgmanager:
+cgmanager: The package contains two daemons: cgmanager (which runs on the host),
+cgmanager: and cgproxy (which runs in containers).
+cgmanager:
+cgmanager: Homepage: https://linuxcontainers.org/cgmanager/
+cgmanager: