This file is indexed.

postinst is in squid3 3.3.8-1ubuntu6.

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
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#! /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_apparmor
if [ "$1" = "configure" ]; then
    APP_PROFILE="/etc/apparmor.d/usr.sbin.squid3"
    if [ -f "$APP_PROFILE" ]; then
        # Add the local/ include
        LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.sbin.squid3"

        test -e "$LOCAL_APP_PROFILE" || {
            tmp=`mktemp`
        cat <<EOM > "$tmp"
# Site-specific additions and overrides for usr.sbin.squid3.
# For more details, please see /etc/apparmor.d/local/README.
EOM
            mkdir `dirname "$LOCAL_APP_PROFILE"` 2>/dev/null || true
            mv -f "$tmp" "$LOCAL_APP_PROFILE"
            chmod 644 "$LOCAL_APP_PROFILE"
        }

        # Reload the profile, including any abstraction updates
        if aa-status --enabled 2>/dev/null; then
            apparmor_parser -r -T -W "$APP_PROFILE" || true
        fi
    fi
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/squid3" ] || [ -e "/etc/init/squid3.conf" ]; then
	if [ ! -e "/etc/init/squid3.conf" ]; then
		update-rc.d squid3 defaults >/dev/null
	fi
	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