File: preinst

package info (click to toggle)
squid 2.6.5-6etch5
  • links: PTS
  • area: main
  • in suites: etch
  • size: 12,540 kB
  • ctags: 13,801
  • sloc: ansic: 105,278; sh: 6,083; makefile: 1,297; perl: 1,245; awk: 40
file content (79 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (2)
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
#! /bin/sh

# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0

warn() {
	db_reset squid/old_version
	db_input high squid/old_version || true
	db_go
	db_get squid/old_version
	if [ "$RET" = "true" ]
	then
		exit 1
	fi
}

case "$1" in
	upgrade|install-upgrade)
		;;
	abort-upgrade)
		exit 0
		;;
esac

#
# See if we upgraded from 1.0 or 1.2
#
if [ "$1" = upgrade ] || [ "$1" = install ]
then
	case "$2" in
		1.0*)
			warn 1.0
			;;
		1.1*)
			warn 1.1
			;;
	esac
fi

#
# See if we upgraded from < 2.5.5-3 and need to move config file
#
if ([ "$1" = upgrade ] && dpkg --compare-versions "$2" le '2.5.5-3' )
then
	if [ -e /etc/squid.conf ]
	then
		if [ ! -d /etc/squid ]
		then
			mkdir /etc/squid
		fi
		if [ -e /etc/squid/squid.conf ]
		then
			mv /etc/squid/squid.conf /etc/squid/squid.conf.dpkg-old
		fi
		mv /etc/squid.conf /etc/squid/squid.conf
		touch /etc/squid/conffile-moved
	fi
fi

#
# Add the "proxy" user/group to /etc/passwd if needed.
#

if ! grep -q "^proxy:" /etc/passwd
then
	#
	#	Let's hope that this works; if /var/spool/squid is
	#	already present this fails :(
	#
	adduser --system --home /var/spool/squid --group proxy
	#
	# Change the shell so that cron jobs will work.
	# (They run as root now, but you can never know).
	#
	chsh -s /bin/sh proxy
fi

exit 0