This file is indexed.

postinst is in lusca 0.1~svn14809-1ubuntu1.

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/lusca/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/lusca/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/lusca
		cache_dir=`grepconf2 cache_dir /var/spool/lusca`
		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 Lusca spool directory structure"
			lusca -z
		fi

		#
		# If winbind is installed, add proxy user to winbindd_priv
		# group
		#
		getent group winbindd_priv >/dev/null 2>&1 &&
			adduser --quiet proxy winbindd_priv

		;;
	abort-upgrade|abort-remove|abort-deconfigure)
		;;
	*)
		#
		#	Unknown action - do nothing.
		#
		exit 0
		;;
esac

#
#	Update links if needed and start lusca.
#
update-rc.d lusca defaults 30 >/dev/null

invoke-rc.d lusca restart

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.



exit 0