[arch-commits] Commit in varnish/trunk (4 files)
Dave Reisner
dreisner at archlinux.org
Wed Aug 15 00:30:15 UTC 2012
Date: Tuesday, August 14, 2012 @ 20:30:14
Author: dreisner
Revision: 165294
upgpkg: varnish 3.0.2-6
- add systemd service
Added:
varnish/trunk/varnish-vcl-reload
varnish/trunk/varnish.service
Modified:
varnish/trunk/PKGBUILD
varnish/trunk/rc.varnish
--------------------+
PKGBUILD | 29 ++++++++++++++++++++---------
rc.varnish | 24 +-----------------------
varnish-vcl-reload | 21 +++++++++++++++++++++
varnish.service | 10 ++++++++++
4 files changed, 52 insertions(+), 32 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2012-08-15 00:13:54 UTC (rev 165293)
+++ PKGBUILD 2012-08-15 00:30:14 UTC (rev 165294)
@@ -6,7 +6,7 @@
pkgname=varnish
pkgver=3.0.2
-pkgrel=5
+pkgrel=6
pkgdesc="High-performance HTTP accelerator"
arch=('i686' 'x86_64')
url="http://www.varnish-cache.org/"
@@ -18,13 +18,17 @@
options=('!libtool')
source=("http://repo.varnish-cache.org/source/$pkgname-$pkgver.tar.gz"
"$pkgname.conf.d"
- "rc.$pkgname")
+ "rc.$pkgname"
+ varnish-vcl-reload
+ varnish.service)
md5sums=('c8eae0aabbe66b6daabdf3a1f58cd47a'
'edd1237d097d72173d9772754335890c'
- '8366f51568c0bbb3d3891aa0cc724369')
+ '40b4c83b3ad225ed2f4bd7e677fe41a2'
+ '56be884f43b8b4c900a073d9282f124a'
+ '45cc1fd57aa2ffc22d6af62f9eedc842')
build() {
- cd "$srcdir/$pkgname-$pkgver"
+ cd "$pkgname-$pkgver"
./configure \
--prefix=/usr \
@@ -35,11 +39,18 @@
}
package() {
- cd "$srcdir/$pkgname-$pkgver"
+ make -C "$pkgname-$pkgver" DESTDIR="$pkgdir" install
- make DESTDIR="$pkgdir" install
+ # reload helper
+ install -m755 "$srcdir/varnish-vcl-reload" "$pkgdir/usr/bin"
- install -D -m755 "$srcdir/rc.$pkgname" "$pkgdir/etc/rc.d/$pkgname"
- install -D -m644 "$srcdir/$pkgname.conf.d" "$pkgdir/etc/conf.d/$pkgname"
- install -D -m644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+ # sysvinit
+ install -Dm755 "$srcdir/rc.$pkgname" "$pkgdir/etc/rc.d/$pkgname"
+ install -Dm644 "$srcdir/$pkgname.conf.d" "$pkgdir/etc/conf.d/$pkgname"
+
+ # systemd
+ install -Dm644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+
+ # license
+ install -Dm644 "$pkgname-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
Modified: rc.varnish
===================================================================
--- rc.varnish 2012-08-15 00:13:54 UTC (rev 165293)
+++ rc.varnish 2012-08-15 00:30:14 UTC (rev 165294)
@@ -4,27 +4,6 @@
. /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"
@@ -62,8 +41,7 @@
$0 start
;;
reload)
- stat_busy "Recompiling and Reloading VCL"
- reload_vcl && stat_done || stat_fail
+ status "Recompiling and Reloading VCL" varnish-vcl-reload $VARNISH_CFG
;;
*)
echo "usage: $0 {start|stop|restart|reload}"
Added: varnish-vcl-reload
===================================================================
--- varnish-vcl-reload (rev 0)
+++ varnish-vcl-reload 2012-08-15 00:30:14 UTC (rev 165294)
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+cfg=${1:-/etc/varnish/default.vcl}
+
+if [ ! -e "$cfg" ]; then
+ printf 'ERROR: VCL file %s does not exist\n' "$cfg" >&2
+ exit 1
+fi
+
+activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }')
+if [ -z "$activecfg" ]; then
+ printf 'ERROR: No active VCL found!\n' >&2
+ exit 1
+fi
+
+newcfg=$(date +'vcl-%s')
+printf 'INFO: using new config %s\n' "$cfg"
+
+varnishadm "vcl.load $newcfg $cfg" &&
+varnishadm "vcl.use $newcfg" &&
+varnishadm "vcl.discard $activecfg"
Added: varnish.service
===================================================================
--- varnish.service (rev 0)
+++ varnish.service 2012-08-15 00:30:14 UTC (rev 165294)
@@ -0,0 +1,10 @@
+[Unit]
+Description=Web Application Accelerator
+After=network.target
+
+[Service]
+ExecStart=/usr/sbin/varnishd -a 0.0.0.0:80 -b localhost:8080 -T localhost:6082 -s malloc,64M -u nobody -g nobody -F
+ExecReload=/usr/bin/varnish-vcl-reload
+
+[Install]
+WantedBy=multi-user.target
More information about the arch-commits
mailing list