Page MenuHomeFreeBSD

D4016.id9741.diff
No OneTemporary

D4016.id9741.diff

Index: www/varnish4/Makefile
===================================================================
--- www/varnish4/Makefile
+++ www/varnish4/Makefile
@@ -2,7 +2,7 @@
PORTNAME= varnish
PORTVERSION= 4.1.0
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= www
MASTER_SITES= http://repo.varnish-cache.org/source/
PKGNAMESUFFIX= 4
Index: www/varnish4/files/varnishd.in
===================================================================
--- www/varnish4/files/varnishd.in
+++ www/varnish4/files/varnishd.in
@@ -41,8 +41,8 @@
# default: "varnish"
#
# varnishd_flags - complete command line arguments.
-# default if varnishd_config is unset: "-j unix,user=${varnishd_jailuser} -P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -h ${varnishd_hash} ${varnishd_extra_flags}"
-# default if varnishd_config is set: "-j unix,user=${varnishd_jailuser} -P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -h ${varnishd_hash} ${varnishd_extra_flags}"
+# default if varnishd_config is unset: "-j unix,user=${varnishd_jailuser} -P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -h ${varnishd_hash} ${varnishd_extra_flags}"
+# default if varnishd_config is set: "-j unix,user=${varnishd_jailuser} -P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -h ${varnishd_hash} ${varnishd_extra_flags}"
#
# See varnishd(1) for a detailed overview of command-line options.
#
@@ -65,6 +65,11 @@
command="%%PREFIX%%/sbin/${name}"
pidfile="${varnishd_pidfile}"
+configtest_cmd="varnishd_checkconfig"
+reload_cmd="varnishd_reload"
+restart_precmd="varnishd_checkconfig"
+start_precmd="varnishd_precmd"
+extra_commands="status reload configtest"
if [ -n "${varnishd_config}" ] ; then
: ${varnishd_flags:="-j unix,user=${varnishd_jailuser} -P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -h ${varnishd_hash} ${varnishd_extra_flags}"}
@@ -72,4 +77,55 @@
: ${varnishd_flags:="-j unix,user=${varnishd_jailuser} -P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -h ${varnishd_hash} ${varnishd_extra_flags}"}
fi
+varnishd_checkconfig()
+{
+ if [ -z "${varnishd_config}" ]; then
+ echo "${name}: nothing to check, no configuration file defined, builtin VCL used"
+ else
+ echo "Performing sanity check on ${name} configuration:"
+ if eval ${command} -C -f "${varnishd_config}" 2> /dev/null ; then
+ echo "${name}: the configuration file ${varnishd_config} syntax is ok"
+ else
+ err 1 "${name}: the configuration file ${varnishd_config} syntax is NOT ok"
+ fi
+ fi
+}
+
+# Adapted from work done by Ingvar Hagelund <ingvar@redpill-linpro.com> (see redhat/varnish_reload_vcl)
+varnishd_reload()
+{
+ local _current_config_name _new_config_name _varnishadm_cmd
+
+ if [ -z "${varnishd_config}" ]; then
+ echo "${name}: nothing to reload, no configuration file defined, builtin VCL used"
+ else
+ _new_config_name="rc.d_reloaded@$(date +%Y%m%d%H%M%S)"
+ _varnishadm_cmd="%%PREFIX%%/bin/varnishadm ${varnish_cli_flags}"
+ if ! eval ${_varnishadm_cmd} vcl.list > /dev/null; then
+ err 1 "${name}: can't connect to varnishadm"
+ fi
+ _current_config_name=$(${_varnishadm_cmd} vcl.list | awk ' /^active/ { print $3 } ')
+ if ! eval ${_varnishadm_cmd} vcl.load ${_new_config_name} ${varnishd_config} > /dev/null; then
+ err 1 "${name}: vcl.load failed, you're still using previous rules (${_current_config_name})"
+ fi
+ if eval ${_varnishadm_cmd} vcl.use ${_new_config_name} > /dev/null; then
+ echo "VCL file \"${varnishd_config}\" has been successfully loaded as \"${_new_config_name}\""
+ echo "To remove previous loaded configurations, you should run \"${_varnishadm_cmd} vcl.discard <configname>\" by yourself"
+ else
+ err 1 "${name}: vcl.use failed, you're still using previous rules (${_current_config_name})"
+ fi
+ fi
+
+ return 0
+}
+
+varnishd_precmd()
+{
+ # Check config before starting
+ varnishd_checkconfig
+
+ echo "varnishd: Cleaning old varnish state."
+ rm -f %%PREFIX%%/varnish/$(hostname)/*_.vsm
+}
+
run_rc_command "$1"
Index: www/varnish4/files/varnishlog.in
===================================================================
--- www/varnish4/files/varnishlog.in
+++ www/varnish4/files/varnishlog.in
@@ -50,11 +50,11 @@
precmd()
{
if [ ! -e ${pidfile} ]; then
- install -o ${varnishlog_user} -g varnish /dev/null ${pidfile};
+ install -o ${varnishlog_user} -g varnish -m 644 /dev/null ${pidfile};
fi
if [ ! -e ${varnishlog_file} ]; then
- install -o ${varnishlog_user} -g varnish /dev/null ${varnishlog_file};
+ install -o ${varnishlog_user} -g varnish -m 664 /dev/null ${varnishlog_file};
fi
waitcount=0
Index: www/varnish4/files/varnishncsa.in
===================================================================
--- www/varnish4/files/varnishncsa.in
+++ www/varnish4/files/varnishncsa.in
@@ -55,11 +55,11 @@
precmd()
{
if [ ! -e ${pidfile} ]; then
- install -o ${varnishncsa_user} -g varnish /dev/null ${pidfile};
+ install -o ${varnishncsa_user} -g varnish -m 644 /dev/null ${pidfile};
fi
if [ ! -e ${varnishncsa_file} ]; then
- install -o ${varnishncsa_user} -g varnish /dev/null ${varnishncsa_file};
+ install -o ${varnishncsa_user} -g varnish -m 664 /dev/null ${varnishncsa_file};
fi
waitcount=0

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 15, 1:35 PM (43 m, 24 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25327982
Default Alt Text
D4016.id9741.diff (5 KB)

Event Timeline