Ticket #39477: varnish-3.0.4.patch
File varnish-3.0.4.patch, 5.6 KB (added by robsonpeixoto@…, 11 years ago) |
---|
-
Portfile
1 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 1 2 # $Id$ 2 3 3 PortSystem 4 PortSystem 1.0 4 5 5 name varnish 6 epoch 20110709 7 version 3.0.3 8 categories www 9 license BSD zlib 10 platforms darwin 11 maintainers pmq openmaintainer 6 name varnish 7 version 3.0.4 8 categories www 9 platforms darwin 10 maintainers pmq openmaintainer 11 license BSD 12 12 13 description 13 description Varnish is a state-of-the-art, high-performance HTTP accelerator 14 14 long_description Varnish was written from the ground up to be a high \ 15 15 performance caching reverse proxy. 16 16 17 homepage 18 master_sites 17 homepage http://www.varnish-cache.org 18 master_sites http://repo.varnish-cache.org/source/ 19 19 20 checksums rmd160 a911a2637ef26607aad8a1c34a83bc797a15235d\21 sha256 2d37d18d952f58b208ac3a0706d4d3e4c0de304b1fcc9df5019571c75f148ab220 checksums rmd160 ed8aba21af17d5fee225eb03950fd90ad7b07911 \ 21 sha256 4e044ccb5c76222bddf89c808f13ea8f66977972675aecb48a920f6800ad0f79 22 22 23 depends_build port:pkgconfig 23 depends_build port:pkgconfig \ 24 port:py27-docutils 24 25 25 26 depends_lib port:pcre 27 28 configure.args-append --with-rst2man=${prefix}/bin/rst2man-2.7.py 29 30 startupitem.create yes 31 startupitem.pidfile auto "${prefix}/var/run/${name}/${name}.pid" 32 startupitem.start "${prefix}/share/${name}/varnish.init start" 33 startupitem.stop "${prefix}/share/${name}/varnish.init stop" 34 startupitem.restart "${prefix}/share/${name}/varnish.init restart" 35 36 post-destroot { 37 # create dir 38 xinstall -d -m 755 ${destroot}${prefix}/share/${name} 39 40 # copy files 41 xinstall -m 644 ${filespath}/varnish.conf.in ${destroot}${prefix}/etc/${name}/varnish.conf.default 42 xinstall -m 755 ${filespath}/varnish.init.in ${destroot}${prefix}/share/${name}/${name}.init 43 xinstall -m 755 ${filespath}/varnish-vcl-reload.in ${destroot}${prefix}/sbin/varnish-vcl-reload 44 45 # replace @PREFIX@ to ${prefix} 46 reinplace "s|@PREFIX@|${prefix}|g" \ 47 ${destroot}${prefix}/etc/${name}/varnish.conf.default \ 48 ${destroot}${prefix}/share/${name}/${name}.init \ 49 ${destroot}${prefix}/sbin/varnish-vcl-reload 50 51 file rename ${destroot}${prefix}/etc/${name}/default.vcl ${destroot}${prefix}/etc/${name}/default.vcl.default 52 } 53 54 post-activate { 55 if {![file exists ${prefix}/etc/${name}/default.vcl]} { 56 file copy ${prefix}/etc/${name}/default.vcl.default \ 57 ${prefix}/etc/${name}/default.vcl 58 } 59 if {![file exists ${prefix}/etc/${name}/varnish.conf]} { 60 file copy ${prefix}/etc/${name}/varnish.conf.default \ 61 ${prefix}/etc/${name}/varnish.conf 62 } 63 64 # dirs nedded to run varnish 65 xinstall -d -m 755 -o nobody -g nobody ${prefix}/var/${name} 66 xinstall -d -m 755 -o nobody -g nobody ${prefix}/var/run/${name} 67 } 68 69 livecheck.url ${master_sites} 70 livecheck.type regex 71 livecheck.regex ${name}-(\\d+\\.\\d+\\.\\d+).tar.gz -
files/varnish-vcl-reload.in
1 #!/bin/sh 2 3 cfg=${1:-@PREFIX@/etc/varnish/default.vcl} 4 if [ ! -e "$cfg" ]; then 5 printf 'ERROR: VCL file %s does not exist\n' "$cfg" >&2 6 exit 1 7 fi 8 9 activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }') 10 if [ -z "$activecfg" ]; then 11 printf 'ERROR: No active VCL found!\n' >&2 12 exit 1 13 fi 14 15 newcfg=$(date +'vcl-%s') 16 printf 'INFO: using new config %s\n' "$cfg" 17 18 varnishadm "vcl.load $newcfg $cfg" && 19 varnishadm "vcl.use $newcfg" && 20 varnishadm "vcl.discard $activecfg" -
files/varnish.conf.in
1 # 2 # MANDATORIES command line options to varnishd 3 # 4 5 VARNISH_CFG="@PREFIX@/etc/varnish/default.vcl" 6 7 VARNISHD_OPTS="-a 0.0.0.0:80 8 -f $VARNISH_CFG 9 -T localhost:6082 10 -s malloc,64M 11 -u nobody -g nobody" -
files/varnish.init.in
1 #!/bin/bash 2 3 . @PREFIX@/etc/varnish/varnish.conf 4 5 VARNISHD_PID="@PREFIX@/var/run/varnish/varnish.pid" 6 7 if [[ -r $VARNISHD_PID ]]; then 8 read -r PID < "$VARNISHD_PID" 9 ps -p $PID &> /dev/null 10 CHECK=$? 11 if [[ "x$CHECK" == "x1" ]]; then 12 unset PID 13 rm -f "$VARNISHD_PID" 14 fi 15 fi 16 17 case $1 in 18 start) 19 @PREFIX@/sbin/varnishd $VARNISHD_OPTS -P $VARNISHD_PID 20 ;; 21 stop) 22 [[ $PID ]] && kill $PID &>/dev/null 23 ;; 24 restart) 25 $0 stop 26 sleep 1 27 $0 start 28 ;; 29 reload) 30 @PREFIX@/sbin/varnish-vcl-reload $VARNISH_CFG 31 ;; 32 *) 33 echo "usage: $0 {start|stop|restart|reload}" 34 ;; 35 esac