Merge lp:~gandelman-a/ubuntu/precise/squid3/lp891445 into lp:ubuntu/precise/squid3

Proposed by Adam Gandelman
Status: Merged
Merge reported by: James Page
Merged at revision: not available
Proposed branch: lp:~gandelman-a/ubuntu/precise/squid3/lp891445
Merge into: lp:ubuntu/precise/squid3
Diff against target: 144 lines (+43/-56)
3 files modified
debian/changelog (+11/-0)
debian/rules (+1/-1)
debian/squid3.upstart (+31/-55)
To merge this branch: bzr merge lp:~gandelman-a/ubuntu/precise/squid3/lp891445
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+82485@code.launchpad.net

Description of the change

The upstart job now shipped with squid3 is an upstart-ified version of the sysv init script shipped with the squid(v2) package. This fixes a couple of bugs in in the pre-start that were a result of the conversion to upstart.

To post a comment you must log in.
34. By Adam Gandelman

* debian/squid3.upstart: Modify to better reflect functionality of Debian's
  squid3.rc
* debian/rules: Fix permissions on upstart job

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-11-11 10:33:44 +0000
3+++ debian/changelog 2011-11-17 22:40:28 +0000
4@@ -1,3 +1,14 @@
5+squid3 (3.1.15-1ubuntu3) precise; urgency=low
6+
7+ * debian/squid3.upstart: Properly return 0 from maxfds() if $SQUID_MAXFD is
8+ unset, else pre-start will fail as well. Also fix paths to config file.
9+ (LP: #891445)
10+ * debian/squid3.upstart: Modify to better reflect functionality of Debian's
11+ squid3.rc
12+ * debian/rules: Fix permissions on upstart job
13+
14+ -- Adam Gandelman <adamg@canonical.com> Wed, 16 Nov 2011 18:26:25 -0800
15+
16 squid3 (3.1.15-1ubuntu2) precise; urgency=low
17
18 * Fix spelling of squid-common transitional package name.
19
20=== modified file 'debian/rules'
21--- debian/rules 2011-11-10 08:59:31 +0000
22+++ debian/rules 2011-11-17 22:40:28 +0000
23@@ -72,7 +72,7 @@
24 install -m 755 -g root -d $(INSTALLDIR)/etc/resolvconf/update-libc.d
25 install -m 755 -g root -d $(INSTALLDIR)/etc/ufw/applications.d
26 install -m 755 -g root debian/squid3.rc $(INSTALLDIR)/etc/init.d/squid3
27- install -m 755 -g root debian/squid3.upstart $(INSTALLDIR)/etc/init/squid3.conf
28+ install -m 644 -g root debian/squid3.upstart $(INSTALLDIR)/etc/init/squid3.conf
29 install -m 755 -g root debian/squid3.resolvconf $(INSTALLDIR)/etc/resolvconf/update-libc.d/squid3
30 install -m 644 -g root debian/squid3.logrotate $(INSTALLDIR)/etc/logrotate.d/squid3
31 install -m 644 -g root debian/squid3.ufw.profile $(INSTALLDIR)/etc/ufw/applications.d/squid3
32
33=== modified file 'debian/squid3.upstart'
34--- debian/squid3.upstart 2011-11-10 08:59:31 +0000
35+++ debian/squid3.upstart 2011-11-17 22:40:28 +0000
36@@ -9,71 +9,47 @@
37 start on runlevel [2345]
38 stop on runlevel [!2345]
39
40-# Disable DNS checks so we can start squid
41-# before a "real" network is available.
42-env SQUID_ARGS="-D"
43+env CONFIG="/etc/squid3/squid.conf"
44+env SQUID_ARGS="-YC"
45
46 pre-start script
47 if [ -f /etc/default/squid3 ]; then
48 . /etc/default/squid3
49 fi
50
51-
52- grepconf () {
53- w=" " # space tab
54- sq=/etc/squid/squid.conf
55- # sed is cool.
56- res=`sed -ne '
57- s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
58- t end;
59- d;
60- :end q' < $sq`
61- [ -n "$res" ] || res=$2
62+ find_cache_dir () {
63+ w=" " # space tab
64+ res=`sed -ne '
65+ s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
66+ t end;
67+ d;
68+ :end q' < $CONFIG`
69+ [ -n "$res" ] || res=$2
70 echo "$res"
71 }
72
73- grepconf2 () {
74- w=" " # space tab
75- sq=/etc/squid/squid.conf
76- # sed is cool.
77- res=`sed -ne '
78- s/^'$1'['"$w"']\+[^'"$w"']\+['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
79- t end;
80- d;
81- :end q' < $sq`
82- [ -n "$res" ] || res=$2
83- echo "$res"
84- }
85- #
86- # Try to increase the # of filedescriptors we can open.
87- #
88- maxfds () {
89- [ -n "$SQUID_MAXFD" ] || return
90- [ -f /proc/sys/fs/file-max ] || return 0
91- global_file_max=`cat /proc/sys/fs/file-max`
92- minimal_file_max=$(($SQUID_MAXFD + 4096))
93- if [ "$global_file_max" -lt $minimal_file_max ]
94- then
95- echo $minimal_file_max > /proc/sys/fs/file-max
96- fi
97- ulimit -n $SQUID_MAXFD
98- }
99-
100- cdr=`grepconf2 cache_dir /var/spool/squid`
101- ctp=`grepconf cache_dir ufs`
102-
103- case "$cdr" in
104- [0-9]*)
105- echo "squid: squid.conf contains 2.2.5 syntax - not starting"
106- exit 1 ; stop
107- ;;
108- esac
109-
110- if [ -d "$cdr" -a ! -d "$cdr/00" ] || [ "$ctp" = "coss" -a ! -w "$cdr" ]
111+ find_cache_type () {
112+ w=" " # space tab
113+ res=`sed -ne '
114+ s/^'$1'['"$w"']\+\([^'"$w"']\+\).*$/\1/p;
115+ t end;
116+ d;
117+ :end q' < $CONFIG`
118+ [ -n "$res" ] || res=$2
119+ echo "$res"
120+ }
121+
122+ cache_dir=`find_cache_dir cache_dir`
123+ cache_type=`find_cache_type cache_dir`
124+
125+ if [ "$cache_type" = "coss" -a -d "$cache_dir" -a ! -f "$cache_dir/stripe" ] ||
126+ [ "$cache_type" != "coss" -a -d "$cache_dir" -a ! -d "$cache_dir/00" ]
127 then
128- /usr/sbin/squid $SQUID_ARGS -z
129+ /usr/sbin/squid3 $SQUID_ARGS -z -f $CONFIG
130 fi
131- maxfds
132+
133+ umask 027
134+ ulimit -n 65535
135 end script
136
137 script
138@@ -81,5 +57,5 @@
139 . /etc/default/squid3
140 fi
141
142- exec /usr/sbin/squid3 -N $SQUID_ARGS
143+ exec /usr/sbin/squid3 -N $SQUID_ARGS -f $CONFIG
144 end script

Subscribers

People subscribed via source and target branches