summaryrefslogtreecommitdiffstats
path: root/sbin/init.d/squid
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2006-07-16 15:09:58 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 12:03:42 +0200
commit6b3930beccbaece638d47bc4a2d5d62c9041117a (patch)
treec872b98adb3762da2974500aa4414b6d51114973 /sbin/init.d/squid
parent[RELEASE] init-scripts-0.3.24 (diff)
downloadinit-scripts-6b3930beccbaece638d47bc4a2d5d62c9041117a.tar.gz
[RELEASE] init-scripts-0.3.25v0.3.25
Diffstat (limited to 'sbin/init.d/squid')
-rwxr-xr-xsbin/init.d/squid46
1 files changed, 46 insertions, 0 deletions
diff --git a/sbin/init.d/squid b/sbin/init.d/squid
index cdb32f1..6b6f328 100755
--- a/sbin/init.d/squid
+++ b/sbin/init.d/squid
@@ -13,7 +13,53 @@ option waitrebuild boolean_option 0
option reuseaddr boolean_option 1
option doublecheck boolean_option 0
option vhostaccel boolean_option 0
+
option bin reserved_option /opt/sbin/squid
+option gbin reserved_option /opt/bin/squidGuard
+option pidfile reserved_option /var/log/squid/squid.pid
+option cmdline reserved_option '$bin -D'
+
+function fct_pre_start {
+
+ valueof $opt_config cache_log >/dev/null 2>&1
+ [ -z "$REPLY" ] && REPLY=/var/log/squid/cache.log
+ [ ! -d ${REPLY%/*} ] && mkdir -p ${REPLY%/*} \
+ && chown -R squid:squid ${REPLY%/*}
+
+ valueof $opt_config cache_dir >/dev/null 2>&1
+ set -- $REPLY ; REPLY=$2
+ [ -z "$REPLY" ] && REPLY=/var/opt/squid/cache
+ [ ! -d $REPLY ] && mkdir -p $REPLY \
+ && chown -R squid:squid $REPLY \
+ && $bin -z
+
+ valueof $opt_config redirect_program >/dev/null 2>&1
+ set -- $REPLY
+ if [ -n "$1" -a -z "${1//*squidGuard*/}" ] ; then
+ echo -n "# Preparing squidGuard ... "
+ [ ! -e /var/log/squidGuard ] && ln -s squid /var/log/squidGuard
+ if [ ! -d /var/cache/squidGuard ] ; then
+ mkdir -p /var/cache/squidGuard
+ do_update_squidguard
+ fi
+ echo "done."
+ fi
+}
+
+function do_update_squidguard {
+ for file in $(find /opt/squidGuard/db/ \
+ -name "*.tgz" -o -name "*.tar.gz") ; do
+ tar zxf $file -C /var/cache/squidGuard
+ done
+ chown -R squid:squid /var/cache/squidGuard
+ sudo -u squid $gbin -C all </dev/null
+ find /var/cache/squidGuard/ -name "*.diff" | while read ; do
+ cat $REPLY >> ${REPLY%%[.0-9]*.diff}.diff
+ done
+ sudo -u squid $gbin -u </dev/null
+ find /var/cache/squidGuard/ -name "*.diff" | xargs rm -f
+ find /var/cache/squidGuard/ -name "*.db"|sed 's/\.db$//'|xargs rm -f
+}
function fct_end_section {
local chroot