[121137] trunk/dports/www/varnish
snc at macports.org
snc at macports.org
Wed Jun 18 09:13:10 PDT 2014
Revision: 121137
https://trac.macports.org/changeset/121137
Author: snc at macports.org
Date: 2014-06-18 09:13:09 -0700 (Wed, 18 Jun 2014)
Log Message:
-----------
varnish: update to 3.0.3, #35863
Modified Paths:
--------------
trunk/dports/www/varnish/Portfile
Added Paths:
-----------
trunk/dports/www/varnish/files/
trunk/dports/www/varnish/files/varnish-vcl-reload.in
trunk/dports/www/varnish/files/varnish.conf.in
trunk/dports/www/varnish/files/varnish.init.in
Modified: trunk/dports/www/varnish/Portfile
===================================================================
--- trunk/dports/www/varnish/Portfile 2014-06-18 16:08:42 UTC (rev 121136)
+++ trunk/dports/www/varnish/Portfile 2014-06-18 16:13:09 UTC (rev 121137)
@@ -5,6 +5,7 @@
name varnish
epoch 20110709
version 3.0.3
+revision 1
categories www
license BSD zlib
platforms darwin
@@ -23,3 +24,44 @@
depends_build port:pkgconfig
depends_lib port:pcre
+
+startupitem.create yes
+startupitem.start "${prefix}/share/${name}/varnish.init start"
+startupitem.stop "${prefix}/share/${name}/varnish.init stop"
+
+post-destroot {
+ # create dir
+ xinstall -d -m 755 ${destroot}${prefix}/share/${name}
+
+ # copy files
+ xinstall -m 644 ${filespath}/varnish.conf.in ${destroot}${prefix}/etc/${name}/varnish.conf.default
+ xinstall -m 755 ${filespath}/varnish.init.in ${destroot}${prefix}/share/${name}/${name}.init
+ xinstall -m 755 ${filespath}/varnish-vcl-reload.in ${destroot}${prefix}/sbin/varnish-vcl-reload
+
+ # replace @PREFIX@ to ${prefix}
+ reinplace "s|@PREFIX@|${prefix}|g" \
+ ${destroot}${prefix}/etc/${name}/varnish.conf.default \
+ ${destroot}${prefix}/share/${name}/${name}.init \
+ ${destroot}${prefix}/sbin/varnish-vcl-reload
+
+ file rename ${destroot}${prefix}/etc/${name}/default.vcl ${destroot}${prefix}/etc/${name}/default.vcl.default
+}
+
+post-activate {
+ if {![file exists ${prefix}/etc/${name}/default.vcl]} {
+ file copy ${prefix}/etc/${name}/default.vcl.default \
+ ${prefix}/etc/${name}/default.vcl
+ }
+ if {![file exists ${prefix}/etc/${name}/varnish.conf]} {
+ file copy ${prefix}/etc/${name}/varnish.conf.default \
+ ${prefix}/etc/${name}/varnish.conf
+ }
+
+ # dirs nedded to run varnish
+ xinstall -d -m 755 -o nobody -g nobody ${prefix}/var/${name}
+ xinstall -d -m 755 -o nobody -g nobody ${prefix}/var/run/${name}
+}
+
+livecheck.url ${master_sites}
+livecheck.type regex
+livecheck.regex ${name}-(\\d+\\.\\d+\\.\\d+).tar.gz
\ No newline at end of file
Added: trunk/dports/www/varnish/files/varnish-vcl-reload.in
===================================================================
--- trunk/dports/www/varnish/files/varnish-vcl-reload.in (rev 0)
+++ trunk/dports/www/varnish/files/varnish-vcl-reload.in 2014-06-18 16:13:09 UTC (rev 121137)
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+cfg=${1:- at PREFIX@/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: trunk/dports/www/varnish/files/varnish.conf.in
===================================================================
--- trunk/dports/www/varnish/files/varnish.conf.in (rev 0)
+++ trunk/dports/www/varnish/files/varnish.conf.in 2014-06-18 16:13:09 UTC (rev 121137)
@@ -0,0 +1,13 @@
+#
+# MANDATORIES command line options to varnishd
+#
+
+VARNISH_CFG="@PREFIX@/etc/varnish/default.vcl"
+VARNISHD_PID="@PREFIX@/var/run/varnish/varnish.pid"
+
+VARNISHD_OPTS="-a 0.0.0.0:80 \
+ -f $VARNISH_CFG \
+ -T localhost:6082 \
+ -P $VARNISHD_PID \
+ -s malloc,64M
+ -u nobody -g nobody"
Added: trunk/dports/www/varnish/files/varnish.init.in
===================================================================
--- trunk/dports/www/varnish/files/varnish.init.in (rev 0)
+++ trunk/dports/www/varnish/files/varnish.init.in 2014-06-18 16:13:09 UTC (rev 121137)
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+. @PREFIX@/etc/varnish/varnish.conf
+
+if [[ -r $VARNISHD_PID ]]; then
+ read -r PID < "$VARNISHD_PID"
+ ps -p $PID &> /dev/null
+ CHECK=$?
+ if [[ "x$CHECK" == "x1" ]]; then
+ unset PID
+ rm -f "$VARNISHD_PID"
+ fi
+fi
+
+case $1 in
+ start)
+ @PREFIX@/sbin/varnishd $VARNISHD_OPTS
+ ;;
+ stop)
+ [[ $PID ]] && kill $PID &>/dev/null
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ reload)
+ @PREFIX@/sbin/varnish-vcl-reload $VARNISH_CFG
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart|reload}"
+ ;;
+esac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140618/aae6ed9b/attachment.html>
More information about the macports-changes
mailing list