2010-05-11 22:54:54 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for mod_chroot
|
|
|
|
# Written by Menno E. Duursma <druiloor@zonnet.nl>
|
|
|
|
|
|
|
|
# This program is free software. It comes without any warranty.
|
|
|
|
# Granted WTFPL, Version 2, as published by Sam Hocevar. See
|
|
|
|
# http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
|
|
|
|
PRGNAM=mod_chroot
|
|
|
|
VERSION=${VERSION:-0.5}
|
2012-09-30 17:09:26 +02:00
|
|
|
BUILD=${BUILD:-3}
|
2010-05-11 22:54:54 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2010-06-04 07:13:17 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-11 22:54:54 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
2010-05-13 00:37:12 +02:00
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
2010-05-11 22:54:54 +02:00
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:37:12 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 22:54:54 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:37:12 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 22:54:54 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-13 00:37:12 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-04 07:13:17 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 22:54:54 +02:00
|
|
|
fi
|
|
|
|
|
2012-09-30 17:09:26 +02:00
|
|
|
set -e
|
2010-05-11 22:54:54 +02:00
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
|
|
|
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 {} \;
|
|
|
|
|
|
|
|
# Create destdir
|
2010-05-13 00:37:12 +02:00
|
|
|
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules
|
2010-05-11 22:54:54 +02:00
|
|
|
|
|
|
|
# Build
|
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
apxs -ca mod_chroot.c
|
|
|
|
|
|
|
|
# Copy into place, and strip
|
2010-05-13 00:37:12 +02:00
|
|
|
install --mode=755 --strip .libs/mod_chroot.so $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules
|
2010-05-11 22:54:54 +02:00
|
|
|
|
|
|
|
# Create initial environment
|
|
|
|
mkdir -p $PKG/var/chroot/httpd/{srv,var/run/httpd,var/www}
|
|
|
|
|
2010-05-13 00:37:12 +02:00
|
|
|
# Install a sample mod_chroot.conf file
|
2011-02-14 00:24:24 +01:00
|
|
|
mkdir -p $PKG/etc/httpd/extra
|
2010-05-13 00:37:12 +02:00
|
|
|
sed "s%@baselibdir@%lib${LIBDIRSUFFIX}%" $CWD/mod_chroot.conf > \
|
2011-02-14 00:24:24 +01:00
|
|
|
$PKG/etc/httpd/extra/mod_chroot.conf.new
|
2010-05-13 00:37:12 +02:00
|
|
|
|
2010-05-11 22:54:54 +02:00
|
|
|
# Documentiation
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a [A-Z][A-Z]* $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
|
|
|
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG
|
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
2010-05-13 00:37:12 +02:00
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
2010-05-11 22:54:54 +02:00
|
|
|
|
|
|
|
cd $PKG
|
2010-05-13 00:37:12 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|