diff options
-rw-r--r-- | network/squid/README | 2 | ||||
-rw-r--r-- | network/squid/doinst.sh | 2 | ||||
-rw-r--r-- | network/squid/rc.squid | 83 | ||||
-rw-r--r-- | network/squid/squid.SlackBuild | 37 | ||||
-rw-r--r-- | network/squid/squid.info | 6 | ||||
-rw-r--r-- | network/squid/squid.logrotate | 1 |
6 files changed, 110 insertions, 21 deletions
diff --git a/network/squid/README b/network/squid/README index 7a1cbe1dc1aa6..3bd042b5eea69 100644 --- a/network/squid/README +++ b/network/squid/README @@ -17,4 +17,4 @@ executable and add the following to /etc/rc.d/rc.local: /etc/rc.d/rc.squid start fi -See /usr/doc/squid-3.0.STABLE2/README.SBo for configuration help. +See /usr/doc/squid-3.0.STABLE10/README.SBo for configuration help. diff --git a/network/squid/doinst.sh b/network/squid/doinst.sh index 18b429664a46e..ca824a11f4d85 100644 --- a/network/squid/doinst.sh +++ b/network/squid/doinst.sh @@ -25,4 +25,4 @@ config etc/rc.d/rc.squid.new config etc/squid/mime.conf.new config etc/squid/squid.conf.new config etc/squid/cachemgr.conf.new - +config etc/logrotate.d/squid.new diff --git a/network/squid/rc.squid b/network/squid/rc.squid new file mode 100644 index 0000000000000..4810dae64f123 --- /dev/null +++ b/network/squid/rc.squid @@ -0,0 +1,83 @@ +#!/bin/sh +# Start/stop/restart/reload the Squid Internet Object Cache (squid) +# To make Squid start automatically at boot, make this +# file executable: chmod 755 /etc/rc.d/rc.Squid +# +# Written for Slackware Linux by Erik Jan Tromp +# Modified by David Somero <xgizzmo@slackbuilds.org> + +SQUIDCFG=/etc/squid/squid.conf +SQUIDCMD=/usr/sbin/squid + +if [ ! -r $SQUIDCFG ]; then + echo "Please set the correct path to $SQUIDCFG" + exit 1 +fi + +if [ ! -x $SQUIDCMD ]; then + echo "$SQUIDCMD not found" + exit 1 +fi + +squid_start() { + # Create cache directory hierarchy if needed + ALL_DIRS=$(awk '/^cache_dir/ {print $3}' $SQUIDCFG) + [ -z "$ALL_DIRS" ] && ALL_DIRS=/var/cache/squid + + for CACHE_DIR in $ALL_DIRS ; do + if [ ! -d $CACHE_DIR/00 ] ; then + echo "Creating swap directories: $SQUIDCMD -z" + $SQUIDCMD -z 2> /dev/null + break + fi + done + + echo "Starting Squid: $SQUIDCMD -DF" + $SQUIDCMD -DF +} + +squid_stop() { + COUNTDOWN=$(awk '/^shutdown_lifetime/ {print $2}' $SQUIDCFG) + [ -z "$COUNTDOWN" ] && COUNTDOWN=30 + + echo -n "Shutting down Squid in $COUNTDOWN seconds: " + $SQUIDCMD -k shutdown 2> /dev/null + while $SQUIDCMD -k check 2> /dev/null ; do + sleep 1 + echo -n . + COUNTDOWN=$[ $COUNTDOWN - 1 ] + if [ $COUNTDOWN -le 0 ] ; then + $SQUIDCMD -k interrupt 2> /dev/null + sleep 1 + break + fi + done + echo +} + +squid_restart() { + squid_stop + sleep 1 + squid_start +} + +squid_reload() { + $SQUIDCMD -k reconfigure 2> /dev/null +} + +case "$1" in +'start') + squid_start + ;; +'stop') + squid_stop + ;; +'restart') + squid_restart + ;; +'reload') + squid_reload + ;; +*) + echo "usage: $0 start|stop|restart|reload" +esac diff --git a/network/squid/squid.SlackBuild b/network/squid/squid.SlackBuild index 7f99dfbdfdfdd..de7206f75dfda 100644 --- a/network/squid/squid.SlackBuild +++ b/network/squid/squid.SlackBuild @@ -24,9 +24,9 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=squid -VERSION=3.0.STABLE2 +VERSION=3.0.STABLE10 ARCH=${ARCH:-i486} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} CWD=$(pwd) @@ -41,6 +41,8 @@ if [ "$ARCH" = "i486" ]; then SLKCFLAGS="-O2 -march=i486 -mtune=i686" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" fi set -e @@ -49,10 +51,14 @@ rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION -tar xvf $CWD/$PRGNAM-$VERSION.tar.*z* +tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 cd $PRGNAM-$VERSION chown -R root:root . -chmod -R u+w,go+r-w,a-s . +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 {} \; CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ @@ -62,12 +68,11 @@ CXXFLAGS="$SLKCFLAGS" \ --localstatedir=/var/log/squid \ --datadir=/usr/share/squid \ --mandir=/usr/man \ - --program-prefix="" \ - --program-suffix="" \ --enable-snmp \ --enable-linux-netfilter \ --enable-async-io \ - --build=i486-slackware-linux + --build=$ARCH-slackware-linux \ + --host=$ARCH-slackware-linux make all make install DESTDIR=$PKG @@ -90,19 +95,21 @@ cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild chown root:root $PKG/usr/doc/$PRGNAM-$VERSION/* mkdir -p $PKG/etc/{logrotate.d,rc.d} -cat $CWD/rc.squid.new > $PKG/etc/rc.d/rc.squid.new -cat $CWD/squid.logrotate > $PKG/etc/logrotate.d/squid +cat $CWD/rc.squid > $PKG/etc/rc.d/rc.squid.new + +# Note that the .new file left hanging around in /etc/logrotate.d/ will +# probably/surely make cron'd logrotations fail, but not installing it +# as .new here will clobber a potentially custom file. +cat $CWD/squid.logrotate > $PKG/etc/logrotate.d/squid.new mv $PKG/etc/squid/mime.conf $PKG/etc/squid/mime.conf.new mv $PKG/etc/squid/cachemgr.conf $PKG/etc/squid/cachemgr.conf.new -rm $PKG/etc/squid/squid.conf ; cp $CWD/squid.conf $PKG/etc/squid/squid.conf.new +rm $PKG/etc/squid/squid.conf +cat $CWD/squid.conf > $PKG/etc/squid/squid.conf.new -mkdir -p $PKG/var/cache/squid -mkdir -p $PKG/var/run/squid +mkdir -p $PKG/var/{cache,run}/squid rmdir $PKG/var/log/squid/logs -chown $SQUIDUSER:$SQUIDGROUP $PKG/var/log/squid -chown $SQUIDUSER:$SQUIDGROUP $PKG/var/cache/squid -chown $SQUIDUSER:$SQUIDGROUP $PKG/var/run/squid +chown $SQUIDUSER:$SQUIDGROUP $PKG/var/{cache,log,run}/squid ## Edit the config file to set the user and group to run as sed -i -e 's%^cache_effective_user nobody%cache_effective_user '"$SQUIDUSER"'%g' \ diff --git a/network/squid/squid.info b/network/squid/squid.info index 5e7aa84221629..0ac81b3efc6ac 100644 --- a/network/squid/squid.info +++ b/network/squid/squid.info @@ -1,8 +1,8 @@ PRGNAM="squid" -VERSION="3.0.STABLE2" +VERSION="3.0.STABLE10" HOMEPAGE="http://www.squid-cache.org/" -DOWNLOAD="http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE2.tar.bz2" -MD5SUM="21b0413c95b5b9b48e816a5f33f86312" +DOWNLOAD="http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE10.tar.bz2" +MD5SUM="cfd37717230220a9f47177594e235f18" MAINTAINER="David Somero" EMAIL="dsomero@hotmail.com" APPROVED="rworkman" diff --git a/network/squid/squid.logrotate b/network/squid/squid.logrotate index 87b66e6df615d..e6d8309b7b09d 100644 --- a/network/squid/squid.logrotate +++ b/network/squid/squid.logrotate @@ -5,7 +5,6 @@ compress notifempty missingok - # This script asks squid to rotate its logs on its own. # Restarting squid is a long process and it is not worth # doing it just to rotate logs |