summaryrefslogtreecommitdiffstats
path: root/main/squid
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-09-01 13:12:42 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-09-01 13:12:42 +0000
commit5d4692319f2ccb4e39b50808e89e765e4c0f980e (patch)
tree83a0ac2feecd82ea38fc4c0abc0b17297c30c127 /main/squid
parent353ecc79dae24a45ab45b41e4c79caa646aeee99 (diff)
downloadaports-5d4692319f2ccb4e39b50808e89e765e4c0f980e.tar.bz2
aports-5d4692319f2ccb4e39b50808e89e765e4c0f980e.tar.xz
main/squid: fix for squid initscript and pidfile
fixes #133
Diffstat (limited to 'main/squid')
-rw-r--r--main/squid/APKBUILD16
-rw-r--r--main/squid/squid-2.7-gentoo.patch2
-rw-r--r--main/squid/squid.initd26
3 files changed, 30 insertions, 14 deletions
diff --git a/main/squid/APKBUILD b/main/squid/APKBUILD
index c93bfba60..111d9ef52 100644
--- a/main/squid/APKBUILD
+++ b/main/squid/APKBUILD
@@ -3,7 +3,7 @@
pkgname=squid
pkgver=2.7.6
_ver=2.7.STABLE6
-pkgrel=6
+pkgrel=7
pkgdesc="A full-featured Web proxy cache server."
url="http://www.squid-cache.org"
install="squid.post-install"
@@ -49,15 +49,17 @@ subpackages="$pkgname-doc
source="http://www.squid-cache.org/Versions/v2/2.7/${pkgname}-${_ver}.tar.bz2
squid.initd
squid.confd
- squid.post-install
squid-2.7-gentoo.patch
$pkgname.logrotate
"
+pkgusers="squid"
+pkggroups="squid"
build() {
cd "$srcdir/$pkgname-$_ver"
patch -p1 -i "$srcdir"/squid-2.7-gentoo.patch || return 1
+
touch NEWS AUTHORS
aclocal && autoconf && automake -a || return 1
@@ -86,7 +88,10 @@ build() {
install -m644 -D "$srcdir"/$pkgname.logrotate \
"$pkgdir"/etc/logrotate.d/squid
- mkdir -p "$pkgdir"/var/cache/squid "$pkgdir"/var/log/squid
+ install -d -o squid -g squid \
+ "$pkgdir"/var/cache/squid \
+ "$pkgdir"/var/log/squid \
+ "$pkgdir"/var/run/squid
chmod +x "$pkgdir"/usr/lib/squid/*
}
@@ -272,8 +277,7 @@ errors_ukrainian_utf8() {
md5sums="6de3a6a7a56a7ecae092f2d31a04f039 squid-2.7.STABLE6.tar.bz2
-d31f293cf10a90bc3d60aa6428889db5 squid.initd
+d7f3f823f5648dae74cb68a3b2c2f70e squid.initd
44b052db7910f386ef88ddcf69c9ba4e squid.confd
-9bf350646e321f7c38ffeb9af828ec98 squid.post-install
-1d33108353d788b238d9a8877bf2e401 squid-2.7-gentoo.patch
+3827f71d940b47eb385a1a1d92a51d66 squid-2.7-gentoo.patch
58823e0b86bc2dc71d270208b7b284b4 squid.logrotate"
diff --git a/main/squid/squid-2.7-gentoo.patch b/main/squid/squid-2.7-gentoo.patch
index 5ac174dee..f9480a990 100644
--- a/main/squid/squid-2.7-gentoo.patch
+++ b/main/squid/squid-2.7-gentoo.patch
@@ -104,7 +104,7 @@ http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-proxy/squid/files/squid-2.7.
DEFAULT_ACCESS_LOG = $(DEFAULT_LOG_PREFIX)/access.log
DEFAULT_STORE_LOG = $(DEFAULT_LOG_PREFIX)/store.log
-DEFAULT_PID_FILE = $(DEFAULT_LOG_PREFIX)/squid.pid
-+DEFAULT_PID_FILE = $(localstatedir)/run/squid.pid
++DEFAULT_PID_FILE = $(localstatedir)/run/squid/squid.pid
DEFAULT_NETDB_FILE = $(DEFAULT_LOG_PREFIX)/netdb.state
-DEFAULT_SWAP_DIR = $(localstatedir)/cache
+DEFAULT_SWAP_DIR = $(localstatedir)/cache/squid
diff --git a/main/squid/squid.initd b/main/squid/squid.initd
index bbdc2bed2..4242b216e 100644
--- a/main/squid/squid.initd
+++ b/main/squid/squid.initd
@@ -5,6 +5,8 @@
opts="${opts} reload rotate"
+conf=/etc/squid/squid.conf
+
depend() {
need net
}
@@ -25,7 +27,7 @@ maxfds() {
checkconfig() {
maxfds
- local CACHE_SWAP=$(awk '/^[ \t]*cache_dir[ \t]+/ { if ($2 == "coss" ) printf "%s/stripe ", $3 ; else printf "%s/00 ", $3; }' < /etc/squid/squid.conf)
+ local CACHE_SWAP=$(awk '/^[ \t]*cache_dir[ \t]+/ { if ($2 == "coss" ) printf "%s/stripe ", $3 ; else printf "%s/00 ", $3; }' < $conf)
[ -z "$CACHE_SWAP" ] && CACHE_SWAP="/var/cache/squid/00"
local x
@@ -50,27 +52,37 @@ checkconfig() {
return 0
}
+get_pidfile() {
+ PIDFILE=$(awk '/^[ \t]*pid_filename[ \t]+/ {print $2}' $conf)
+ [ -z "$PIDFILE" ] && PIDFILE=/var/run/squid/squid.pid
+}
+
start() {
+ get_pidfile
checkconfig || return 1
ebegin "Starting squid"
- KRB5_KTNAME="${SQUID_KEYTAB}" /usr/sbin/squid ${SQUID_OPTS}
+ start-stop-daemon --start --pidfile "$PIDFILE" \
+ --env KRB5_KTNAME="${SQUID_KEYTAB}" \
+ --exec /usr/sbin/squid -- ${SQUID_OPTS}
eend $? && sleep 1
}
stop() {
+ local rc=0
ebegin "Stopping squid"
+ get_pidfile
/usr/sbin/squid -k shutdown
+
# Now we have to wait until squid has _really_ stopped.
- sleep 1
- if [ -f /var/run/squid.pid ] ; then
+ if [ -f "$PIDFILE" ] ; then
einfon "Waiting for squid to shutdown ."
cnt=0
- while [ -f /var/run/squid.pid ] ; do
+ while [ -f "$PIDFILE" ] ; do
cnt=$(expr $cnt + 1)
if [ $cnt -gt 60 ] ; then
# Waited 120 seconds now. Fail.
echo
- eend 1 "Failed."
+ rc=1
break
fi
sleep 2
@@ -78,7 +90,7 @@ stop() {
done
echo
fi
- eend 0
+ eend $rc
}
reload() {