summaryrefslogtreecommitdiff
path: root/pkgs/varnish
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/varnish')
-rw-r--r--pkgs/varnish/PKGBUILD47
-rw-r--r--pkgs/varnish/varnish.conf9
-rwxr-xr-xpkgs/varnish/varnish.init41
-rw-r--r--pkgs/varnish/varnish.install4
-rwxr-xr-xpkgs/varnish/varnish.log.runit4
-rwxr-xr-xpkgs/varnish/varnish.runit28
6 files changed, 133 insertions, 0 deletions
diff --git a/pkgs/varnish/PKGBUILD b/pkgs/varnish/PKGBUILD
new file mode 100644
index 0000000..9d46c93
--- /dev/null
+++ b/pkgs/varnish/PKGBUILD
@@ -0,0 +1,47 @@
+# Maintainer: Jaroslav Lichtblau <dragonlord@aur.archlinux.org>
+# Contributor: Douglas Soares de Andrade
+# Contributor: Roberto Alsina <ralsina@kde.org>
+
+pkgname=varnish
+pkgver=2.1.3
+pkgrel=1
+pkgdesc="High-performance HTTP accelerator"
+arch=('i686' 'x86_64')
+url="http://www.varnish-cache.org/"
+license=('BSD')
+depends=('ncurses' 'pcre')
+backup=('etc/varnish.conf')
+install=$pkgname.install
+options=('!libtool')
+source=(http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz \
+ $pkgname.conf \
+ $pkgname.init \
+ $pkgname.runit \
+ $pkgname.log.runit)
+md5sums=('357d99a760de173d841ac37bf2052be8'
+ '2816759b6185d08c98309e33948599c6'
+ 'c9a4856f6ec6f3cb01ab33e28d77d3a9'
+ '34681f7ed6fef8deb7b9a0e291f22ddb'
+ '2ee74b4a9166dc2ad260dc8885bd7fd3')
+
+build() {
+ cd ${srcdir}/$pkgname-$pkgver
+
+ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
+ make
+}
+
+package() {
+ cd ${srcdir}/$pkgname-$pkgver
+
+ make DESTDIR=${pkgdir} install
+
+ install -d ${pkgdir}/var/$pkgname/$(hostname)
+ install -D -m755 ${srcdir}/$pkgname.init ${pkgdir}/etc/rc.d/$pkgname
+ install -D -m755 ${srcdir}/$pkgname.runit ${pkgdir}/etc/sv/$pkgname/run
+ install -D -m755 ${srcdir}/$pkgname.log.runit ${pkgdir}/etc/sv/$pkgname/log/run
+ install -D -m755 ${srcdir}/$pkgname.conf ${pkgdir}/etc/$pkgname.conf
+
+#license
+ install -D -m644 LICENSE ${pkgdir}/usr/share/licenses/$pkgname/LICENSE
+}
diff --git a/pkgs/varnish/varnish.conf b/pkgs/varnish/varnish.conf
new file mode 100644
index 0000000..d768261
--- /dev/null
+++ b/pkgs/varnish/varnish.conf
@@ -0,0 +1,9 @@
+# Options for the varnishd command line
+# For example:
+# OPTS="-b varnish.projects.linpro.no"
+# Read the varnishd man page for info
+#
+# Use -F if you want to use it with runit
+# or daemontools
+#
+OPTS="-b localhost:80 -u nobody -g nobody -n /var/varnish/$hostname"
diff --git a/pkgs/varnish/varnish.init b/pkgs/varnish/varnish.init
new file mode 100755
index 0000000..b90ebf5
--- /dev/null
+++ b/pkgs/varnish/varnish.init
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/varnish.conf
+
+PID=`pidof %PPID /usr/sbin/varnishd`
+
+case "$1" in
+ start)
+ stat_busy "Starting Varnish Reverse Proxy"
+ /usr/sbin/varnishd $OPTS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon varnish
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Varnish Reverse Proxy"
+ kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon varnish
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+ ;;
+esac
+exit 0
diff --git a/pkgs/varnish/varnish.install b/pkgs/varnish/varnish.install
new file mode 100644
index 0000000..e951df3
--- /dev/null
+++ b/pkgs/varnish/varnish.install
@@ -0,0 +1,4 @@
+# arg 1: the new package version
+post_install () {
+ echo "==> Edit /etc/varnish.conf to configure."
+}
diff --git a/pkgs/varnish/varnish.log.runit b/pkgs/varnish/varnish.log.runit
new file mode 100755
index 0000000..d5220b7
--- /dev/null
+++ b/pkgs/varnish/varnish.log.runit
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+svname=$( cd .. && basename $( pwd ) )
+exec /usr/bin/logger -t $svname -p daemon.info
diff --git a/pkgs/varnish/varnish.runit b/pkgs/varnish/varnish.runit
new file mode 100755
index 0000000..e9e647f
--- /dev/null
+++ b/pkgs/varnish/varnish.runit
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# general config
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+. /etc/varnish.conf
+
+BIN="/usr/sbin/varnishd"
+
+PID=`pidof %PPID $BIN`
+
+killjobs () {
+ kill $PID >&/dev/null
+}
+
+trap killjobs INT QUIT TERM EXIT KILL HUP
+
+if [ -z "$PID" ]
+then
+ $BIN $OPTS
+else
+ for P in $PID
+ do
+ watchpid $P &
+ done
+fi
+wait