#! /bin/sh set -e grepconf () { w=" " # space tab # sed is cool. res=`squid -k parse 2>&1 | grep "Processing:" | sed s/.*Processing:\ // | sed -ne ' s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q'` [ -n "$res" ] || res=$2 echo "$res" } grepconf2 () { w=" " # space tab # sed is cool. res=`squid -k parse 2>&1 | grep "Processing:" | sed s/.*Processing:\ // | sed -ne ' s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p; t end; d; :end q'` [ -n "$res" ] || res=$2 echo "$res" } case "$1" in configure) # # Chown the directories. # log_dir=/var/log/squid-ssl cache_dir=`grepconf2 cache_dir /var/spool/squid-ssl` usr=`grepconf cache_effective_user proxy` grp=`grepconf cache_effective_group proxy` if [ "$(stat -c %U $cache_dir)" != "$usr" ] || [ "$(stat -c %G $cache_dir)" != "$grp" ] ; then chown $usr:$grp $cache_dir -R fi if [ "$(stat -c %U $log_dir)" != "$usr" ] || [ "$(stat -c %G $log_dir)" != "$grp" ] ; then if [ "$(dpkg-statoverride --list $log_dir)" = "" ] ; then chown -R $usr:$grp $log_dir fi 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 #invoke-rc.d squid restart # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. #DEBHELPER# exit 0