postinst is in squid3 3.1.19-1ubuntu2.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | #! /bin/sh
set -e
grepconf () {
w=" " # space tab
sq=/etc/squid3/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/squid3/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"
}
case "$1" in
configure)
#
# Chown the directories.
#
log_dir=/var/log/squid3
cache_dir=`grepconf2 cache_dir /var/spool/squid3`
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
#
# Create spool dirs if they don't exist.
#
if [ -d "$cache_dir" -a ! -d "$cache_dir/00" ]
then
echo "Creating Squid HTTP proxy 3.x spool directory structure"
squid3 -z
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
#
# Unknown action - do nothing.
#
exit 0
;;
esac
if [ -e "/etc/init/squid3.conf" ] ; then
# Using stop/start because restart fails to reload the upstart job
# file. See LP: #707479.
invoke-rc.d squid3 stop || :
invoke-rc.d squid3 start
fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# Automatically added by dh_installinit
if [ -e "/etc/init/squid3.conf" ]; then
invoke-rc.d squid3 start || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
update-rc.d -f squid3 remove >/dev/null || exit $?
# End automatically added section
exit 0
|