network/squid: Updated for version 3.0.STABLE10

This commit is contained in:
David Somero 2010-05-11 22:25:45 +02:00 committed by Robby Workman
parent a076c5e85b
commit 4b92df5b32
6 changed files with 110 additions and 21 deletions

View File

@ -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.

View File

@ -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

83
network/squid/rc.squid Normal file
View File

@ -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

View File

@ -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' \

View File

@ -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"

View File

@ -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