Ticket #35863: 3.0.3-startupitem-reloadscript.patch
File 3.0.3-startupitem-reloadscript.patch, 5.8 KB (added by robsonpeixoto@…, 12 years ago) |
---|
-
Portfile
1 1 # $Id$ 2 2 3 PortSystem 3 PortSystem 1.0 4 4 5 name 6 epoch 201107097 version 3.0.28 revision 9 categories 10 platforms 11 maintainers 5 name varnish 6 epoch 20120820 7 version 3.0.3 8 revision 1 9 categories www 10 platforms darwin 11 maintainers pmq openmaintainer 12 12 13 description 14 long_description 15 13 description Varnish is a state-of-the-art, high-performance HTTP accelerator 14 long_description Varnish was written from the ground up to be a high \ 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 sha1 906f1536cb7e728d18d9425677907ae723943df7\21 rmd160 6093839815ba72107fa2b52f0a198167a3a6b79b20 checksums rmd160 a911a2637ef26607aad8a1c34a83bc797a15235d \ 21 sha256 2d37d18d952f58b208ac3a0706d4d3e4c0de304b1fcc9df5019571c75f148ab2 22 22 23 depends_build 23 depends_build port:pkgconfig 24 24 25 depends_lib port:pcre 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-destroot { 33 xinstall -m 755 -d "${prefix}/var/varnish" 34 35 move ${destroot}${prefix}/etc/varnish/default.vcl ${destroot}${prefix}/etc/varnish/default.vcl.default 36 if {![file exists ${prefix}/etc/varnish/default.vcl]} { 37 xinstall -m 755 -d "${prefix}/etc/varnish" 38 xinstall -m 644 ${destroot}${prefix}/etc/varnish/default.vcl.default ${prefix}/etc/varnish/default.vcl 39 notes-append "Please, configure the ${prefix}/etc/varnish/default.vcl before start the service." 40 } 41 42 xinstall -m 755 "${filespath}/varnish-server.in" "${destroot}${prefix}/sbin/varnish-server" 43 xinstall -m 755 "${filespath}/varnish-vcl-reload.in" "${destroot}${prefix}/bin/varnish-vcl-reload" 44 xinstall -m 644 "${filespath}/varnish-server.conf.in" "${destroot}${prefix}/etc/varnish/varnish-server.conf.default" 45 46 reinplace "s|@PREFIX@|${prefix}|g" "${destroot}${prefix}/sbin/varnish-server" 47 reinplace "s|@PREFIX@|${prefix}|g" "${destroot}${prefix}/bin/varnish-vcl-reload" 48 reinplace "s|@PREFIX@|${prefix}|g" "${destroot}${prefix}/etc/varnish/varnish-server.conf.default" 49 50 if {![file exists ${prefix}/etc/varnish/varnish-server.conf]} { 51 xinstall -m 755 -d "${prefix}/etc/varnish" 52 xinstall -m 644 "${destroot}${prefix}/etc/varnish/varnish-server.conf.default" "${prefix}/etc/varnish/varnish-server.conf" 53 notes-append "The file ${prefix}/etc/varnish/varnish-server.conf is used by ${prefix}/sbin/varnish-server." 54 } 55 } 56 57 livecheck.url ${master_sites} 58 livecheck.type regex 59 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 5 VARNISH_CFG="@PREFIX@/etc/varnish/default.vcl" 6 7 VARNISH_PID="@PREFIX@/var/run/varnishd.pid" 8 9 VARNISHD_OPTS="-a 0.0.0.0:80 \ 10 -f $VARNISH_CFG \ 11 -T localhost:6082 \ 12 -P $VARNISH_PID \ 13 -s malloc,64M 14 -u nobody -g nobody" -
files/varnish-server.in
1 #!/bin/bash 2 3 . @PREFIX@/etc/varnish/varnish-server.conf 4 5 case $1 in 6 start) 7 if /opt/local/sbin/varnishd $VARNISHD_OPTS; then 8 exit 0 9 else 10 echo "Varnish start FAIL" 11 exit 1 12 fi 13 ;; 14 stop) 15 if [[ $PID ]] && kill $PID &>/dev/null; then 16 exit 0 17 else 18 exit 1 19 fi 20 ;; 21 restart) 22 $0 stop 23 sleep 1 24 $0 start 25 ;; 26 reload) 27 status "Recompiling and Reloading VCL" varnish-vcl-reload $VARNISH_CFG 28 ;; 29 *) 30 echo "usage: $0 {start|stop|restart|reload}" 31 ;; 32 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"