[arch-commits] Commit in varnish/trunk (PKGBUILD rc.varnish varnish.conf.d)

Dave Reisner dreisner at archlinux.org
Fri Dec 30 04:10:21 UTC 2011


    Date: Thursday, December 29, 2011 @ 23:10:21
  Author: dreisner
Revision: 145757

upgpkg: varnish 3.0.2-3

- define default config
- add VCL reload functionaliy

Modified:
  varnish/trunk/PKGBUILD
  varnish/trunk/rc.varnish
  varnish/trunk/varnish.conf.d

----------------+
 PKGBUILD       |    8 ++++----
 rc.varnish     |   25 +++++++++++++++++++++++++
 varnish.conf.d |    2 ++
 3 files changed, 31 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2011-12-30 00:51:02 UTC (rev 145756)
+++ PKGBUILD	2011-12-30 04:10:21 UTC (rev 145757)
@@ -1,4 +1,4 @@
-# $Id
+# $Id$
 # Maintainer: Dave Reisner <dreisner at archlinux.org>
 # Contributor: Jaroslav Lichtblau <dragonlord at aur.archlinux.org>
 # Contributor: Douglas Soares de Andrade
@@ -6,7 +6,7 @@
 
 pkgname=varnish
 pkgver=3.0.2
-pkgrel=2
+pkgrel=3
 pkgdesc="High-performance HTTP accelerator"
 arch=('i686' 'x86_64')
 url="http://www.varnish-cache.org/"
@@ -20,8 +20,8 @@
         "$pkgname.conf.d"
         "rc.$pkgname")
 md5sums=('c8eae0aabbe66b6daabdf3a1f58cd47a'
-         'd42eebc7f0ac429d9740125ff1e61daf'
-         '18b7747020ecfe2eac7445971a7014e3')
+         'edd1237d097d72173d9772754335890c'
+         'fc9bf7a47479c4ad01c0e555d4e74f91')
 
 build() {
   cd "$srcdir/$pkgname-$pkgver"

Modified: rc.varnish
===================================================================
--- rc.varnish	2011-12-30 00:51:02 UTC (rev 145756)
+++ rc.varnish	2011-12-30 04:10:21 UTC (rev 145757)
@@ -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 -T localhost:6082 "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 -T localhost:6082 "vcl.load $newcfg $VARNISH_CFG" &&
+  varnishadm -T localhost:6082 "vcl.use $newcfg" &&
+  varnishadm -T localhost:6082 "vcl.discard $activecfg" || return 1
+}
+
 pidfile=/run/varnish.pid
 if [[ -r $pidfile ]]; then
   read -r PID < "$pidfile"
@@ -40,6 +61,10 @@
     sleep 1
     $0 start
     ;;
+  reload)
+    stat_busy "Recompiling and Reloading VCL"
+    reload_vcl && stat_done || stat_fail
+    ;;
   *)
     echo "usage: $0 {start|stop|restart}"
   ;;

Modified: varnish.conf.d
===================================================================
--- varnish.conf.d	2011-12-30 00:51:02 UTC (rev 145756)
+++ varnish.conf.d	2011-12-30 04:10:21 UTC (rev 145757)
@@ -7,3 +7,5 @@
                -T localhost:6082 \
                -s malloc,64M
                -u nobody -g nobody"
+
+VARNISH_CFG="/etc/varnish/default.vcl"




More information about the arch-commits mailing list