summaryrefslogtreecommitdiff
path: root/network/mod_chroot
diff options
context:
space:
mode:
Diffstat (limited to 'network/mod_chroot')
-rw-r--r--network/mod_chroot/README18
-rw-r--r--network/mod_chroot/doinst.sh15
-rw-r--r--network/mod_chroot/mod_chroot.SlackBuild18
-rw-r--r--network/mod_chroot/mod_chroot.conf3
-rw-r--r--network/mod_chroot/mod_chroot.info4
5 files changed, 41 insertions, 17 deletions
diff --git a/network/mod_chroot/README b/network/mod_chroot/README
index 391c8e0805..5495f1ba29 100644
--- a/network/mod_chroot/README
+++ b/network/mod_chroot/README
@@ -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
diff --git a/network/mod_chroot/doinst.sh b/network/mod_chroot/doinst.sh
new file mode 100644
index 0000000000..19f5d6fd25
--- /dev/null
+++ b/network/mod_chroot/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/httpd/mod_chroot.conf.new
+
diff --git a/network/mod_chroot/mod_chroot.SlackBuild b/network/mod_chroot/mod_chroot.SlackBuild
index 5ef4c197c7..3808faf7fb 100644
--- a/network/mod_chroot/mod_chroot.SlackBuild
+++ b/network/mod_chroot/mod_chroot.SlackBuild
@@ -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}
diff --git a/network/mod_chroot/mod_chroot.conf b/network/mod_chroot/mod_chroot.conf
new file mode 100644
index 0000000000..cbee6da957
--- /dev/null
+++ b/network/mod_chroot/mod_chroot.conf
@@ -0,0 +1,3 @@
+# Apache config for mod_chroot
+ChrootDir /var/chroot/httpd
+LoadModule chroot_module @baselibdir@/httpd/modules/mod_chroot.so
diff --git a/network/mod_chroot/mod_chroot.info b/network/mod_chroot/mod_chroot.info
index 13bb20cb56..86dcbc691b 100644
--- a/network/mod_chroot/mod_chroot.info
+++ b/network/mod_chroot/mod_chroot.info
@@ -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" \ No newline at end of file
+APPROVED="David Somero"