summaryrefslogtreecommitdiff
path: root/extra/varnish
diff options
context:
space:
mode:
authorNicolas Reynolds <fauno@kiwwwi.com.ar>2012-01-03 11:39:36 -0300
committerNicolas Reynolds <fauno@kiwwwi.com.ar>2012-01-03 11:39:36 -0300
commitca2e05bb7791418f2af678704160d56d8184a21a (patch)
tree48a6f85c00b3ed2362cc4d9c9d7f5230bb854eba /extra/varnish
parent45675ec8babcd9ea73f6a49f51f6e7da9d1f1592 (diff)
parent48c96871761a4aad193d814e87ddb87c322e17d2 (diff)
Merge branch 'master' of ssh://vparabola/home/parabola/abslibre-pre-mips64el
Conflicts: community-staging/libgda3/PKGBUILD community/intel-tbb/PKGBUILD community/mtpaint/PKGBUILD extra/cmake/PKGBUILD extra/graphicsmagick/PKGBUILD extra/kdeadmin/PKGBUILD extra/kdelibs/PKGBUILD extra/lyx/PKGBUILD extra/qtscriptgenerator/PKGBUILD kde-unstable/kdeadmin/PKGBUILD kde-unstable/kdelibs/PKGBUILD kde-unstable/kdeplasma-addons/PKGBUILD libre/libretools/PKGBUILD libre/p7zip-libre/PKGBUILD multilib-testing/lib32-glibc/PKGBUILD multilib/wine/PKGBUILD testing/glibc/PKGBUILD
Diffstat (limited to 'extra/varnish')
-rw-r--r--extra/varnish/PKGBUILD8
-rw-r--r--extra/varnish/rc.varnish27
-rw-r--r--extra/varnish/varnish.conf.d2
-rw-r--r--extra/varnish/varnish.install2
4 files changed, 33 insertions, 6 deletions
diff --git a/extra/varnish/PKGBUILD b/extra/varnish/PKGBUILD
index 11053221d..a9292949c 100644
--- a/extra/varnish/PKGBUILD
+++ b/extra/varnish/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id
+# $Id: PKGBUILD 145793 2012-01-01 02:41:17Z dreisner $
# Maintainer: Dave Reisner <dreisner@archlinux.org>
# Contributor: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
# Contributor: Douglas Soares de Andrade
@@ -6,7 +6,7 @@
pkgname=varnish
pkgver=3.0.2
-pkgrel=2
+pkgrel=4
pkgdesc="High-performance HTTP accelerator"
arch=(mips64el)
url="http://www.varnish-cache.org/"
@@ -20,8 +20,8 @@ source=("http://repo.varnish-cache.org/source/$pkgname-$pkgver.tar.gz"
"$pkgname.conf.d"
"rc.$pkgname")
md5sums=('c8eae0aabbe66b6daabdf3a1f58cd47a'
- 'd42eebc7f0ac429d9740125ff1e61daf'
- '18b7747020ecfe2eac7445971a7014e3')
+ 'edd1237d097d72173d9772754335890c'
+ '8366f51568c0bbb3d3891aa0cc724369')
build() {
cd "$srcdir/$pkgname-$pkgver"
diff --git a/extra/varnish/rc.varnish b/extra/varnish/rc.varnish
index 2ebd97e33..2841665e5 100644
--- a/extra/varnish/rc.varnish
+++ b/extra/varnish/rc.varnish
@@ -4,6 +4,27 @@
. /etc/rc.d/functions
. /etc/conf.d/varnish
+reload_vcl() {
+ local activecfg newcfg
+
+ if [[ -z $VARNISH_CFG ]]; then
+ printf '==> ERROR: VARNISH_CFG is undefined in /etc/conf.d/varnish!\n'
+ return 1
+ fi
+
+ activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }')
+ if [[ -z $activecfg ]]; then
+ printf '==> ERROR: No active VCL found!\n'
+ return 1
+ fi
+
+ printf -v newcfg 'vcl-%(%s)T' -1
+
+ varnishadm "vcl.load $newcfg $VARNISH_CFG" &&
+ varnishadm "vcl.use $newcfg" &&
+ varnishadm "vcl.discard $activecfg" || return 1
+}
+
pidfile=/run/varnish.pid
if [[ -r $pidfile ]]; then
read -r PID < "$pidfile"
@@ -14,7 +35,7 @@ if [[ -r $pidfile ]]; then
fi
fi
-case "$1" in
+case $1 in
start)
stat_busy "Starting Varnish Reverse Proxy"
if /usr/sbin/varnishd $VARNISHD_OPTS -P "$pidfile"; then
@@ -40,6 +61,10 @@ case "$1" in
sleep 1
$0 start
;;
+ reload)
+ stat_busy "Recompiling and Reloading VCL"
+ reload_vcl && stat_done || stat_fail
+ ;;
*)
echo "usage: $0 {start|stop|restart}"
;;
diff --git a/extra/varnish/varnish.conf.d b/extra/varnish/varnish.conf.d
index 2970468b7..904ca119f 100644
--- a/extra/varnish/varnish.conf.d
+++ b/extra/varnish/varnish.conf.d
@@ -7,3 +7,5 @@ VARNISHD_OPTS="-a 0.0.0.0:80 \
-T localhost:6082 \
-s malloc,64M
-u nobody -g nobody"
+
+VARNISH_CFG="/etc/varnish/default.vcl"
diff --git a/extra/varnish/varnish.install b/extra/varnish/varnish.install
index fceaf4be7..1cbb1f16e 100644
--- a/extra/varnish/varnish.install
+++ b/extra/varnish/varnish.install
@@ -2,5 +2,5 @@
# remove localstatedir -- compiled VCL and slab files will still be here.
post_remove() {
- rm -rf /var/lib/varnish
+ rm -rf var/lib/varnish
}