Ticket #35863: startupitem_livecheck.patch
File startupitem_livecheck.patch, 4.7 KB (added by robsonpeixoto@…, 12 years ago) |
---|
-
Portfile
5 5 name varnish 6 6 epoch 20110709 7 7 version 3.0.3 8 revision 1 8 9 categories www 9 10 platforms darwin 10 11 maintainers pmq openmaintainer … … 22 23 depends_build port:pkgconfig 23 24 24 25 depends_lib port:pcre 26 27 startupitem.create yes 28 startupitem.start "${prefix}/sbin/varnish-server start" 29 startupitem.stop "${prefix}/sbin/varnish-server stop" 30 startupitem.restart "${prefix}/sbin/varnish-server restart" 31 32 post-build { 33 copy ${filespath}/varnish-server.in ${workpath}/varnish-server 34 copy ${filespath}/varnish-vcl-reload.in ${workpath}/varnish-vcl-reload 35 copy ${filespath}/varnish-server.conf.in ${workpath}/varnish-server.conf.default 36 37 reinplace "s|@PREFIX@|${prefix}|g" \ 38 ${workpath}/varnish-server \ 39 ${workpath}/varnish-vcl-reload \ 40 ${workpath}/varnish-server.conf.default 41 } 42 43 post-destroot { 44 move ${destroot}${prefix}/etc/varnish/default.vcl ${destroot}${prefix}/etc/varnish/default.vcl.default 45 46 xinstall -m 755 ${workpath}/varnish-server ${destroot}${prefix}/sbin/varnish-server 47 xinstall -m 755 ${workpath}/varnish-vcl-reload ${destroot}${prefix}/bin/varnish-vcl-reload 48 xinstall -m 644 ${workpath}/varnish-server.conf.default ${destroot}${prefix}/etc/varnish/varnish-server.conf.default 49 } 50 51 post-activate { 52 if {![file exists ${prefix}/etc/varnish/varnish-server.conf]} { 53 file copy ${prefix}/etc/varnish/varnish-server.conf.default \ 54 ${prefix}/etc/varnish/varnish-server.conf 55 } 56 if {![file exists ${prefix}/etc/varnish/default.vcl]} { 57 file copy ${prefix}/etc/varnish/default.vcl.default \ 58 ${prefix}/etc/varnish/default.vcl 59 } 60 xinstall -m 755 -d ${prefix}/var/varnish/ 61 } 62 63 livecheck.url ${master_sites} 64 livecheck.type regex 65 livecheck.regex varnish-(\\d+\\.\\d+\\.\\d+).tar.gz -
files/varnish-server.conf.in
1 # Command line options to varnishd 2 # based on https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/varnish 3 4 VARNISH_CFG="@PREFIX@/etc/varnish/default.vcl" 5 6 VARNISH_PID="@PREFIX@/var/run/varnishd.pid" 7 8 VARNISHD_OPTS="-a 0.0.0.0:80 \ 9 -f $VARNISH_CFG \ 10 -T localhost:6082 \ 11 -P $VARNISH_PID \ 12 -s malloc,64M \ 13 -u nobody -g nobody" -
files/varnish-server.in
1 #!/bin/bash 2 3 . @PREFIX@/etc/varnish/varnish-server.conf 4 5 pidfile=$VARNISH_PID 6 if [[ -r $pidfile ]]; then 7 read -r PID < "$pidfile" 8 ps -p $PID 2&> /dev/null 9 if [[ $? != 0 ]]; then 10 # stale pidfile 11 unset PID 12 rm -f "$pidfile" 13 fi 14 fi 15 16 case $1 in 17 start) 18 if /opt/local/sbin/varnishd $VARNISHD_OPTS; then 19 exit 0 20 else 21 echo "Varnish start FAIL" 22 exit 1 23 fi 24 ;; 25 stop) 26 if [[ $PID ]] && kill $PID &>/dev/null; then 27 exit 0 28 else 29 exit 1 30 fi 31 ;; 32 restart) 33 $0 stop 34 sleep 1 35 $0 start 36 ;; 37 reload) 38 status "Recompiling and Reloading VCL" varnish-vcl-reload $VARNISH_CFG 39 ;; 40 *) 41 echo "usage: $0 {start|stop|restart|reload}" 42 ;; 43 esac -
files/varnish-vcl-reload.in
Property changes on: files/varnish-server.in ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property
1 #!/bin/sh 2 # based on https://projects.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/varnish 3 4 cfg=${1:-@PREFIX@/etc/varnish/default.vcl} 5 if [ ! -e "$cfg" ]; then 6 printf 'ERROR: VCL file %s does not exist\n' "$cfg" >&2 7 exit 1 8 fi 9 10 activecfg=$(varnishadm 'vcl.list' | awk '/active/ { print $3 }') 11 if [ -z "$activecfg" ]; then 12 printf 'ERROR: No active VCL found!\n' >&2 13 exit 1 14 fi 15 16 newcfg=$(date +'vcl-%s') 17 printf 'INFO: using new config %s\n' "$cfg" 18 19 varnishadm "vcl.load $newcfg $cfg" && 20 varnishadm "vcl.use $newcfg" && 21 varnishadm "vcl.discard $activecfg"