Date: Sat, 29 Nov 2008 18:20:03 GMT From: Darren Pilgrim <phi@evilphi.com> To: freebsd-ports-bugs@FreeBSD.org Subject: Re: ports/129274: [mail/dovecot] Patch to dovecot.sh.in to facilitate multi-instance configurations Message-ID: <200811291820.mATIK3gG060005@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/129274; it has been noted by GNATS. From: Darren Pilgrim <phi@evilphi.com> To: bug-followup@FreeBSD.org Cc: Subject: Re: ports/129274: [mail/dovecot] Patch to dovecot.sh.in to facilitate multi-instance configurations Date: Sat, 29 Nov 2008 09:58:21 -0800 This is a multi-part message in MIME format. --------------070909040508090908030304 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I missed a %%PREFIX%% in the previous diff. A revised diff is attached. --------------070909040508090908030304 Content-Type: text/plain; name="dovecot.sh.in.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dovecot.sh.in.diff" --- dovecot.sh.in 2008-11-28 10:49:23.000000000 -0800 +++ dovecot.sh.in.new 2008-11-29 09:55:10.000000000 -0800 @@ -20,23 +20,27 @@ # read configuration and set defaults load_rc_config ${name} : ${dovecot_enable:="NO"} +: ${dovecot_config:="%%PREFIX%%/etc/dovecot.conf"} +: ${dovecot_extra_configs:=""} command="%%PREFIX%%/sbin/${name}" -command_args="-c ${dovecot_config:="%%PREFIX%%/etc/${name}.conf"}" -required_files="${dovecot_config}" +required_files="${dovecot_config} ${dovecot_extra_configs}" +restart_cmd="restart_cmd" start_precmd="start_precmd" stop_postcmd="stop_postcmd" extra_commands="restart" -base_dir=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^base_dir:/ { print $2 }') -login_dir=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^login_dir:/ { print $2 }') -login_user=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^login_user:/ { print $2 }') - -pidfile="${base_dir}/master.pid" - +restart_cmd() +{ # Overriding this makes rc.subr run this once for each instance + run_rc_command stop + run_rc_command start +} + start_precmd() { # Ensure runtime directories exist with correct permissions - local gid + local login_dir login_user gid + login_dir=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^login_dir:/ { print $2 }') + login_user=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^login_user:/ { print $2 }') gid=$(/usr/sbin/pw usershow -n "${login_user}" 2>/dev/null | /usr/bin/cut -d: -f4) /usr/bin/install -o root -g wheel -m 0755 -d ${base_dir} /usr/bin/install -o root -g ${gid} -m 0750 -d ${login_dir} @@ -47,4 +51,9 @@ rm -rf ${base_dir} 2>/dev/null } -run_rc_command "$1" +for config in ${dovecot_config} ${dovecot_extra_configs}; do + command_args="-c ${config}" + base_dir=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^base_dir:/ { print $2 }') + pidfile="${base_dir}/master.pid" + run_rc_command "$1" +done --------------070909040508090908030304--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811291820.mATIK3gG060005>