From a2ce6fc7c2d93d57d191b16bfd9e1ddf0b5e75a6 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Wed, 21 Dec 2011 06:29:02 -0500 Subject: development/schroot: Added (secure chroot utility) Signed-off-by: dsomero --- development/schroot/README | 14 ++++ development/schroot/doinst.sh | 15 ++++ development/schroot/pam_misc.diff | 25 +++++++ development/schroot/program_options.patch | 13 ++++ development/schroot/schroot.SlackBuild | 114 ++++++++++++++++++++++++++++++ development/schroot/schroot.info | 10 +++ development/schroot/slack-desc | 19 +++++ 7 files changed, 210 insertions(+) create mode 100644 development/schroot/README create mode 100644 development/schroot/doinst.sh create mode 100644 development/schroot/pam_misc.diff create mode 100644 development/schroot/program_options.patch create mode 100644 development/schroot/schroot.SlackBuild create mode 100644 development/schroot/schroot.info create mode 100644 development/schroot/slack-desc diff --git a/development/schroot/README b/development/schroot/README new file mode 100644 index 000000000000..80976a4671b4 --- /dev/null +++ b/development/schroot/README @@ -0,0 +1,14 @@ + Schroot is an evolution of the Unix "chroot" command, with +enhancements that make it well suited for software development, +especially for testing build and install scripts such as Slackbuild +scripts where virtualization is not necessary. + + Schroot supports many types of chrooted environments, from simple +directories to filesystem images, and can automate steps such as +remounting /proc, /dev, and /tmp, setting up the chroots password +and group files, etc. + + To get started, see schroot.conf(5) and schroot-setup(5). + + This package will link against Linux-PAM if it is present. + diff --git a/development/schroot/doinst.sh b/development/schroot/doinst.sh new file mode 100644 index 000000000000..f00b3312c13a --- /dev/null +++ b/development/schroot/doinst.sh @@ -0,0 +1,15 @@ +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... +} + +config etc/schroot/schroot.conf.new +config etc/pam.d/schroot.new diff --git a/development/schroot/pam_misc.diff b/development/schroot/pam_misc.diff new file mode 100644 index 000000000000..91ad50feac57 --- /dev/null +++ b/development/schroot/pam_misc.diff @@ -0,0 +1,25 @@ +--- schroot-1.4.0/sbuild/sbuild-auth-pam-conv-tty.h.orig 2010-02-20 10:30:25.426447989 -0500 ++++ schroot-1.4.0/sbuild/sbuild-auth-pam-conv-tty.h 2010-02-20 10:30:48.196230114 -0500 +@@ -24,7 +24,6 @@ + #include + + #include +-#include + + namespace sbuild + { +--- schroot-1.4.0/sbuild/sbuild-auth-pam.cc.orig 2010-02-20 10:35:54.444312134 -0500 ++++ schroot-1.4.0/sbuild/sbuild-auth-pam.cc 2010-02-20 10:37:25.747231482 -0500 +@@ -42,8 +42,11 @@ + #define PAM_TEXT_DOMAIN "Linux-PAM" + #elif defined(__sun__) + #define PAM_TEXT_DOMAIN "SUNW_OST_SYSOSPAM" ++#elif defined(OPENPAM) ++#define PAM_TEXT_DOMAIN "OpenPAM" + #endif + ++ + namespace + { + + diff --git a/development/schroot/program_options.patch b/development/schroot/program_options.patch new file mode 100644 index 000000000000..901ed7383bcb --- /dev/null +++ b/development/schroot/program_options.patch @@ -0,0 +1,13 @@ +diff --git a/configure.ac b/configure.ac +index cf09108..07fd32b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -529,7 +529,7 @@ AC_MSG_CHECKING([for boost::program_options::variables_map in -lboost_program_op + saved_LIBS="${LIBS}" + LIBS="${saved_LIBS} -lboost_program_options" + define([testprog], [AC_LANG_PROGRAM([#include ], +- [boost::program_options::variables_map::variables_map dummy()])]) ++ [boost::program_options::variables_map dummy()])]) + AC_LINK_IFELSE(testprog, + [AC_MSG_RESULT([yes]) + BOOST_LIBS="${BOOST_LIBS} -lboost_program_options"], diff --git a/development/schroot/schroot.SlackBuild b/development/schroot/schroot.SlackBuild new file mode 100644 index 000000000000..529835bb8ffe --- /dev/null +++ b/development/schroot/schroot.SlackBuild @@ -0,0 +1,114 @@ +#!/bin/sh + +# Slackware build script for schroot +# Written by Andy Bailey, GooseYArd@gmail.com +# Taken over by Vincent Batts, vbatts@hashbangbash.com + +# Copyright 2011 Vincent Batts, Vienna, VA, 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. + +PRGNAM=schroot +VERSION=${VERSION:-1.4.19} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + *) export ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv4t" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM\_$VERSION.orig.tar.bz2 +cd $PRGNAM-$VERSION +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 {} \; + +patch -p1 < $CWD/pam_misc.diff + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --mandir=/usr/man \ + --docdir=/usr/doc/$PRGNAM-$VERSION \ + --build=$ARCH-slackware-linux + +make +make install DESTDIR=$PKG + +mv $PKG/etc/schroot/schroot.conf{,.new} +# I know this is unused, but let us leave it anyways ;) +mv $PKG/etc/pam.d/schroot{,.new} + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + AUTHORS ChangeLog INSTALL COPYING README TODO VERSION NEWS \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/development/schroot/schroot.info b/development/schroot/schroot.info new file mode 100644 index 000000000000..5cd761c8f74c --- /dev/null +++ b/development/schroot/schroot.info @@ -0,0 +1,10 @@ +PRGNAM="schroot" +VERSION="1.4.19" +HOMEPAGE="http://packages.debian.org/sid/schroot" +DOWNLOAD="http://ftp.de.debian.org/debian/pool/main/s/schroot/schroot_1.4.19.orig.tar.bz2" +MD5SUM="b4ba1738a9e211956e19920244bcecb0" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Vincent Batts" +EMAIL="vbatts@hashbangbash.com" +APPROVED="dsomero" diff --git a/development/schroot/slack-desc b/development/schroot/slack-desc new file mode 100644 index 000000000000..264dfdc68c1a --- /dev/null +++ b/development/schroot/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------------------------------------------------------| +schroot: schroot (secure chroot utility) +schroot: +schroot: Securely enter a chroot and run a command or login shell. +schroot: +schroot: +schroot: +schroot: +schroot: +schroot: +schroot: +schroot: -- cgit v1.2.3