cvs commit: ports/www/varnish Makefile ports/www/varnish/files
pkg-message.in varnishd.in varnishlog.in varnishncsa.in
Doug Barton
dougb at FreeBSD.org
Wed Oct 14 04:21:58 UTC 2009
Dag-Erling Smørgrav wrote:
> Doug Barton <dougb at FreeBSD.org> writes:
>> Also in varnishd, the test for the existence of $varnishd_config
>> should really be encased in a pre_start method since that's the only
>> time it's relevant (unless I'm missing something).
>
> When does pre_start run?
um, before start? :) After load_rc_config is what I think you're
getting at. It's run as part of run_rc_command.
> Does your patch allow the user to override
> varnishd_flags?
Good point. I added that to the attached version.
Doug
--
Improve the effectiveness of your Internet presence with
a domain name makeover! http://SupersetSolutions.com/
-------------- next part --------------
Index: varnishd.in
===================================================================
RCS file: /home/pcvs/ports/www/varnish/files/varnishd.in,v
retrieving revision 1.7
diff -u -r1.7 varnishd.in
--- varnishd.in 13 Oct 2009 18:51:10 -0000 1.7
+++ varnishd.in 14 Oct 2009 04:13:48 -0000
@@ -4,7 +4,7 @@
#
# PROVIDE: varnishd
-# REQUIRE: DAEMON
+# REQUIRE: LOGIN
# KEYWORD: shutdown
#
@@ -34,15 +34,18 @@
# varnishd_storage - storage method and parameters.
# default: "file,/tmp,50%"
#
-# varnishd_user - unprivileged user for the child process.
+# varnishd_uid - unprivileged user for the child process.
# default: "www"
#
-# varnishd_group - unprivileged group for the child process.
+# varnishd_gid - unprivileged group for the child process.
# default: "www"
#
# varnishd_flags - complete command line arguments.
-# default if varnishd_config is unset: "-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -u ${varnishd_user} -g ${varnishd_group}"
-# default if varnishd_config is set: "-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -u ${varnishd_user} -g ${varnishd_group}"
+# Common flags: -P ${varnishd_pidfile} -a ${varnishd_listen}
+# -T ${varnishd_admin} -s ${varnishd_storage}
+# -u ${varnishd_uid} -g ${varnishd_gid}
+# default if varnishd_config is unset: "<Common flags> -b ${varnishd_backend}"
+# default if varnishd_config is set: "<Common flags> -f ${varnishd_config}"
#
# See varnishd(1) for a detailed overview of command-line options.
#
@@ -54,6 +57,23 @@
command="%%PREFIX%%/sbin/${name}"
+start_precmd=${name}_prestart
+
+varnishd_prestart()
+{
+ [ -n "$varnishd_flags" ] && return
+
+ local common
+
+ common="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -s ${varnishd_storage} -u ${varnishd_uid} -g ${varnishd_group}"
+
+ if [ -n "${varnishd_config}" ] ; then
+ varnishd_flags="$common -f ${varnishd_config}"
+ else
+ varnishd_flags="$common -b ${varnishd_backend}"
+ fi
+}
+
# read configuration and set defaults
load_rc_config ${name}
: ${varnishd_enable:="NO"}
@@ -63,18 +83,8 @@
: ${varnishd_backend:="localhost:8080"}
: ${varnishd_config:=""}
: ${varnishd_storage:="file,/tmp,50%"}
-: ${varnishd_user:="www"}
-: ${varnishd_group:="www"}
-if [ -n "${varnishd_config}" ] ; then
- : ${varnishd_flags:="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -f ${varnishd_config} -s ${varnishd_storage} -u ${varnishd_user} -g ${varnishd_group}"}
-else
- : ${varnishd_flags:="-P ${varnishd_pidfile} -a ${varnishd_listen} -T ${varnishd_admin} -b ${varnishd_backend} -s ${varnishd_storage} -u ${varnishd_user} -g ${varnishd_group}"}
-fi
-
-# If we leave these set, rc.subr will su to them before starting
-# varnishd, which is not what we want.
-unset varnishd_user
-unset varnishd_group
+: ${varnishd_uid:="www"}
+: ${varnishd_gid:="www"}
pidfile="${varnishd_pidfile}"
run_rc_command "$1"
More information about the cvs-ports
mailing list