2010-05-11 15:01:36 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for suPHP
|
|
|
|
|
2010-05-12 17:44:15 +02:00
|
|
|
# Written by Menno Duursma <druiloor@zonnet.nl>
|
|
|
|
|
|
|
|
# This program is free software. It comes without any warranty.
|
|
|
|
# Granted WTFPLv2, as published by Sam Hocevar dec'04.
|
|
|
|
# For details see http://sam.zoy.org/wtfpl/COPYING
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
PRGNAM=suphp
|
2010-05-12 17:44:15 +02:00
|
|
|
VERSION=${VERSION:-0.7.1}
|
2010-05-11 15:01:36 +02:00
|
|
|
ARCH=${ARCH:-i486}
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2010-05-11 22:25:46 +02:00
|
|
|
|
2010-05-11 19:46:03 +02:00
|
|
|
CWD=$(pwd)
|
2010-05-11 15:01:36 +02:00
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
2010-05-12 17:44:15 +02:00
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
# On capability enabled filesystems this may be enabled
|
|
|
|
FCAPS=${FCAPS:-false}
|
2010-05-11 15:01:36 +02:00
|
|
|
|
2010-05-11 22:25:46 +02:00
|
|
|
# The stock Apache on Slackware runs httpd under system
|
2010-05-11 19:46:03 +02:00
|
|
|
# user/group account 'apache'. If you happen to use some
|
2010-05-11 22:25:46 +02:00
|
|
|
# other account change the directives below
|
|
|
|
HTTPD_USER=${HTTPD_USER:-apache}
|
|
|
|
HTTPD_GROUP=${HTTPD_GROUP:-apache}
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:38:24 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 15:01:36 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:38:24 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 22:25:46 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
2010-05-13 00:38:24 +02:00
|
|
|
LIBDIRSUFFIX="64"
|
2010-05-11 15:01:36 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-11 22:25:46 +02:00
|
|
|
set -e # Exit on most errors
|
|
|
|
|
2010-05-11 15:01:36 +02:00
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf $PRGNAM-$VERSION
|
2010-05-11 22:25:46 +02:00
|
|
|
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
|
2010-05-11 15:01:36 +02:00
|
|
|
cd $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
|
|
|
chmod -R u+w,go+r-w,a-s .
|
|
|
|
|
2010-05-12 17:44:15 +02:00
|
|
|
# FCAPS: remove ruid-root check from source
|
|
|
|
if [ "$FCAPS" != "false" ]; then
|
|
|
|
patch --verbose -p1 < $CWD/patches/suphp-0.7.1-nosuid.diff
|
|
|
|
fi
|
2010-05-11 15:01:36 +02:00
|
|
|
|
2010-05-11 22:25:46 +02:00
|
|
|
# Default to secure settings, as any of the configuration options
|
2010-05-12 17:44:15 +02:00
|
|
|
# can be overwritten in the config file /etc/httpd/suphp.conf anyway
|
2010-05-11 15:01:36 +02:00
|
|
|
CFLAGS="$SLKCFLAGS" \
|
|
|
|
CXXFLAGS="$SLKCFLAGS" \
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
2010-05-13 00:38:24 +02:00
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
2010-05-11 15:01:36 +02:00
|
|
|
--with-apr=/usr/bin/apr-1-config \
|
|
|
|
--with-apxs=/usr/sbin/apxs \
|
2010-05-11 19:46:03 +02:00
|
|
|
--sysconfdir=/etc/httpd \
|
2010-05-11 15:01:36 +02:00
|
|
|
--with-apache-user=$HTTPD_USER \
|
2010-05-11 22:25:46 +02:00
|
|
|
--with-logfile=/var/log/httpd/suphp_log \
|
|
|
|
--enable-static=no \
|
2010-05-12 17:44:15 +02:00
|
|
|
--build=$ARCH-slackware-linux
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
make
|
|
|
|
|
2010-05-12 17:44:15 +02:00
|
|
|
# Following only strips the wrapper
|
|
|
|
make install-strip DESTDIR=$PKG
|
|
|
|
|
|
|
|
# Strip the DSO as well
|
2010-05-19 08:45:57 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cp -a AUTHORS COPYING ChangeLog doc/* $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
|
2010-05-12 17:44:15 +02:00
|
|
|
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE
|
2010-05-11 15:01:36 +02:00
|
|
|
|
2010-05-11 19:46:03 +02:00
|
|
|
mkdir -p $PKG/etc/httpd
|
2010-05-13 00:38:24 +02:00
|
|
|
sed "s%@LIBDIR@%/usr/lib${LIBDIRSUFFIX}%" $CWD/config/mod_suphp.conf > \
|
|
|
|
$PKG/etc/httpd/mod_suphp.conf.new
|
2010-05-12 17:44:15 +02:00
|
|
|
|
|
|
|
# Make sure the user Apache runs as in correctly reflected
|
2010-05-13 00:38:24 +02:00
|
|
|
sed "s/@HTTPD_USER@/$HTTPD_USER/" \
|
2010-05-12 17:44:15 +02:00
|
|
|
$CWD/config/suphp.conf > $PKG/etc/httpd/suphp.conf.new
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
|
|
|
|
|
|
|
# Make sure the access permissions on target host are such that
|
|
|
|
# only the group Apache runs as has access to it
|
2010-05-12 17:44:15 +02:00
|
|
|
chown root:$HTTPD_GROUP $PKG/usr/sbin/suphp
|
|
|
|
|
|
|
|
# Install setuid unless caller requested otherwise
|
|
|
|
if [ "$FCAPS" != "false" ]; then
|
|
|
|
chmod 0750 $PKG/usr/sbin/suphp
|
|
|
|
# Note: on a chrooted Apache: this should fence the jail
|
|
|
|
echo 'setcap "cap_setgid=ep cap_setuid=ep" usr/sbin/suphp' \
|
|
|
|
>> $PKG/install/doinst.sh
|
|
|
|
else
|
|
|
|
# Install setuid-root
|
|
|
|
chmod 4750 $PKG/usr/sbin/suphp
|
|
|
|
fi
|
2010-05-11 15:01:36 +02:00
|
|
|
|
|
|
|
cd $PKG
|
2010-05-13 00:38:24 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|