pkg://squid_2.4.6-2woody8_i386.deb:685178/postinst
info downloads
#! /bin/sh
# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
grepconf () {
w=" " # space tab
sq=/etc/squid.conf
# sed is cool.
res=`sed -ne '
s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
t end;
d;
:end q' < $sq`
[ -n "$res" ] || res=$2
echo "$res"
}
grepconf2 () {
w=" " # space tab
sq=/etc/squid.conf
# sed is cool.
res=`sed -ne '
s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
t end;
d;
:end q' < $sq`
[ -n "$res" ] || res=$2
echo "$res"
}
#
# Fix old style "cache_dir /var/spool/squid 100 16 256"
# to include "ufs" (Unix File System) after "cache_dir".
#
conf_fix_cache_dir () {
# get value for squid/fix_lines
db_get squid/fix_lines
# handle it!
if [ "$RET" = "true" ] ; then
sed -e 's/^cache_dir\(.*\)$/cache_dir ufs\1/' \
-e 's/^\(dns_children.*\)$/#NOT IN 2.3#\1/' \
-e 's/^\(dns_defnames.*\)$/#NOT IN 2.3#\1/' \
-e 's/^\(cache_dns_program.*\)$/#NOT IN 2.3#\1/' \
< /etc/squid.conf > /etc/squid.conf.TMP && \
mv /etc/squid.conf.TMP /etc/squid.conf
fi
}
#
# The http_anonymizer option doesn't exist anymore.
# Warn the user through debconf.
#
conf_fix_anonymizer () {
w=" " # space tab
if grep -q "^http_anonymizer[$w]*" /etc/squid.conf
then
db_text high squid/http_anonymizer || true
db_go
fi
}
#
# We moved from /etc/cron.d/squid to /etc/logrotate.d/squid
#
conf_fix_logrotate () {
c=/etc/cron.daily/squid
if [ -f $c ]
then
cp -a $c $c.disabled
( head -1 $c
echo "#"
echo "# DISABLED - squid now uses /etc/logrotate.d/squid"
echo "# please remove this file."
echo "#"
) > $c.disabled
tail +2 $c >> $c.disabled
rm -f $c
fi
}
case "$1" in
configure)
# Compatibility symlinks into /usr/doc
if [ -d /usr/doc -a ! -e /usr/doc/squid \
-a -d /usr/share/doc/squid ]
then
ln -sf ../share/doc/squid /usr/doc/squid
fi
if [ ! -f /etc/squid.conf ]; then
cp /usr/share/doc/squid/examples/squid.conf \
/etc/squid.conf
chmod 0600 /etc/squid.conf
fi
# Check for old incompatible configs
case "$2" in
2.[12].*) conf_fix_cache_dir ;;
esac
conf_fix_anonymizer
conf_fix_logrotate
#
# Chown the directories.
#
dir=`grepconf2 cache_dir /var/spool/squid`
usr=`grepconf squid_effective_user proxy`
grp=`grepconf squid_effective_group proxy`
if [ "$RET" = "false" ]; then
echo "squid.conf contains 2.2.5 syntax - not doing anything!"
else
chown $usr:$grp $dir
chown $usr:$grp /var/log/squid
fi
#
# Create spool dirs if they don't exist.
#
if [ -d "$dir" -a ! -d "$dir/00" ]
then
echo "Creating squid spool directory structure"
/usr/sbin/squid -z
fi
#
# Install /etc/default/squid file if it doesn't
# exist yet.
#
if [ ! -f /etc/default/squid ]
then
cp /usr/share/doc/squid/examples/default.squid \
/etc/default/squid
chmod 644 /etc/default/squid
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
#
# Unknown action - do nothing.
#
exit 0
;;
esac
#
# Update links if needed and start squid.
#
update-rc.d squid defaults 30 >/dev/null
cd /
if [ "$RET" = "false" ]; then
echo "squid.conf contains 2.2.5 syntax - cache_dir directive - not starting "
echo "Run 'dpkg-reconfigure -plow squid' to fix this automatically,"
echo "or fix the 'cache_dir'-entry in your squid.conf manually."
echo "See documentation in /usr/share/doc/squid for nearer instructions."
else
/etc/init.d/squid start
fi