File: config

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 (73 lines) | stat: -rw-r--r-- 1,572 bytes parent folder | download | duplicates (3)
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
#!/bin/sh -e

#
#       check for old config-style in squid.conf
#       (include "ufs" (Unix File System) after "cache_dir".)
#

# Source debconf library.
. /usr/share/debconf/confmodule
db_version 2.0
          
grepconf () {
	w=" 	" # space tab
	sq=/etc/squid/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/squid/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"
}

conf_fix_check_cache_dir () {
  
  if [ -f "/etc/squid/squid.conf" ]; then
  
    sq=/etc/squid/squid.conf
    w="     " # space tab
    grep -q "^cache_dir[$w]*[^/$w]" /etc/squid/squid.conf && return
    umask 022
    
    if grep -q '^dns_children\|^dns_defnames\|^cache_dns_program' $sq || ( grep -q '^cache_dir' $sq && ! grep -q '^cache_dir.*ufs' $sq ); then
   
       # ask debconf-question here
       db_input high squid/fix_lines || true
       db_go
    
    fi
  
  fi
} 

conf_fix_cachedir_perms () {

  if [ -f "/etc/squid/squid.conf" ]; then
	dir=`grepconf2 cache_dir /var/spool/squid`
	usr=`grepconf cache_effective_user proxy`
	grp=`grepconf cache_effective_group proxy`
		
	if [ "$(/usr/bin/stat -L -c %U $dir)" != "$usr" ] || [ "$(/usr/bin/stat -L -c %G $dir)" != "$grp" ] ; then
	  db_input high "squid/fix_cachedir_perms" || true
	  db_go
	fi
  fi
}

conf_fix_check_cache_dir
conf_fix_cachedir_perms