mirror of
https://github.com/SlackBuildsOrg/slackbuilds
synced 2024-09-30 05:39:56 +02:00
network/mod_chroot: Updated for version 0.5
This commit is contained in:
parent
9bc1c57c1f
commit
6dd98402af
5 changed files with 41 additions and 17 deletions
|
@ -7,15 +7,11 @@ hierarchy (containing /dev, /lib, /etc...), unless an external handler, such
|
|||
as suEXEC or suPHP, is being used, or system()-like functions are in use.
|
||||
|
||||
This package pre-creates /var/chroot/httpd with just enough subdirs to enable
|
||||
the stock Slackware config to run. Provided /etc/httpd/httpd.conf contains:
|
||||
the stock Slackware config to run. You'll need to add the following line to
|
||||
your /etc/httpd/httpd.conf file:
|
||||
Include /etc/httpd/mod_chroot.conf
|
||||
|
||||
ChrootDir /var/chroot/httpd
|
||||
LoadModule chroot_module lib/httpd/modules/mod_chroot.so
|
||||
|
||||
And the following (or similar) commands where run:
|
||||
|
||||
mount -o nosuid,nodev --bind /var/run/httpd /var/chroot/httpd/var/run/httpd
|
||||
mount -o nosuid,nodev --bind /srv /var/chroot/httpd/srv
|
||||
mount --bind /var/www /var/chroot/httpd/var/www
|
||||
|
||||
Above commands maybe added to rc.local.
|
||||
You'll also need to add the following lines to your /etc/fstab file:
|
||||
/var/run/httpd /var/chroot/httpd/var/run/httpd none bind
|
||||
/srv /var/chroot/httpd/srv none bind
|
||||
/var/www /var/chroot/httpd/var/www none bind
|
||||
|
|
15
network/mod_chroot/doinst.sh
Normal file
15
network/mod_chroot/doinst.sh
Normal file
|
@ -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/httpd/mod_chroot.conf.new
|
||||
|
|
@ -16,14 +16,17 @@ TAG=${TAG:-_SBo}
|
|||
CWD=$(pwd)
|
||||
TMP=${TMP:-/tmp/SBo}
|
||||
PKG=$TMP/package-$PRGNAM
|
||||
OUTPUT=${OUTPUT:-/tmp} # Drop the package in /tmp
|
||||
OUTPUT=${OUTPUT:-/tmp}
|
||||
|
||||
if [ "$ARCH" = "i486" ]; then
|
||||
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "i686" ]; then
|
||||
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
||||
LIBDIRSUFFIX=""
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
SLKCFLAGS="-O2 -fPIC"
|
||||
LIBDIRSUFFIX="64"
|
||||
fi
|
||||
|
||||
set -e # Exit on most errors
|
||||
|
@ -42,7 +45,7 @@ find . \
|
|||
-exec chmod 644 {} \;
|
||||
|
||||
# Create destdir
|
||||
mkdir -p $PKG/usr/lib/httpd/modules
|
||||
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules
|
||||
|
||||
# Build
|
||||
CFLAGS="$SLKCFLAGS" \
|
||||
|
@ -50,11 +53,16 @@ CXXFLAGS="$SLKCFLAGS" \
|
|||
apxs -ca mod_chroot.c
|
||||
|
||||
# Copy into place, and strip
|
||||
install --mode=755 --strip .libs/mod_chroot.so $PKG/usr/lib/httpd/modules
|
||||
install --mode=755 --strip .libs/mod_chroot.so $PKG/usr/lib${LIBDIRSUFFIX}/httpd/modules
|
||||
|
||||
# Create initial environment
|
||||
mkdir -p $PKG/var/chroot/httpd/{srv,var/run/httpd,var/www}
|
||||
|
||||
# Install a sample mod_chroot.conf file
|
||||
mkdir -p $PKG/etc/httpd/
|
||||
sed "s%@baselibdir@%lib${LIBDIRSUFFIX}%" $CWD/mod_chroot.conf > \
|
||||
$PKG/etc/httpd/mod_chroot.conf.new
|
||||
|
||||
# Documentiation
|
||||
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
cp -a [A-Z][A-Z]* $PKG/usr/doc/$PRGNAM-$VERSION
|
||||
|
@ -63,7 +71,7 @@ cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG
|
|||
|
||||
mkdir -p $PKG/install
|
||||
cat $CWD/slack-desc > $PKG/install/slack-desc
|
||||
cat $CWD/doinst.sh > $PKG/install/doinst.sh
|
||||
|
||||
# Make the package; be sure to leave it in $OUTPUT
|
||||
cd $PKG
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz
|
||||
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|
||||
|
|
3
network/mod_chroot/mod_chroot.conf
Normal file
3
network/mod_chroot/mod_chroot.conf
Normal file
|
@ -0,0 +1,3 @@
|
|||
# Apache config for mod_chroot
|
||||
ChrootDir /var/chroot/httpd
|
||||
LoadModule chroot_module @baselibdir@/httpd/modules/mod_chroot.so
|
|
@ -3,6 +3,8 @@ VERSION="0.5"
|
|||
HOMEPAGE="http://core.segfault.pl/~hobbit/mod_chroot/"
|
||||
DOWNLOAD="http://core.segfault.pl/~hobbit/mod_chroot/dist/mod_chroot-0.5.tar.gz"
|
||||
MD5SUM="d72716052faa3bdd3371210f26b13f38"
|
||||
DOWNLOAD_x86_64=""
|
||||
MD5SUM_x86_64=""
|
||||
MAINTAINER="Menno E. Duursma"
|
||||
EMAIL="druiloor@zonnet.nl"
|
||||
APPROVED="David Somero"
|
||||
APPROVED="David Somero"
|
||||
|
|
Loading…
Reference in a new issue