From 0572483cd9987cd38dee2e82b9e53b759a0749d2 Mon Sep 17 00:00:00 2001 From: jlam Date: Mon, 19 Jul 2004 22:02:15 +0000 Subject: Don't hardcode directories... instead, use postconf to dig them out of the postfix configuration. Also make required_{dirs,files} work in the installed rc.d script. --- mail/postfix/files/postfix.sh | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'mail') diff --git a/mail/postfix/files/postfix.sh b/mail/postfix/files/postfix.sh index 46a49eae606..6daf21c2375 100644 --- a/mail/postfix/files/postfix.sh +++ b/mail/postfix/files/postfix.sh @@ -1,6 +1,6 @@ #!@RCD_SCRIPTS_SHELL@ # -# $NetBSD: postfix.sh,v 1.3 2004/07/19 04:51:07 jlam Exp $ +# $NetBSD: postfix.sh,v 1.4 2004/07/19 22:02:15 jlam Exp $ # # PROVIDE: mail @@ -12,11 +12,12 @@ name="postfix" rcvar=$name -required_files="@PKG_SYSCONFDIR@/main.cf" +postfix_command="@PREFIX@/sbin/${name}" +: ${required_files=`@PREFIX@/sbin/postconf -h config_directory`/main.cf} start_precmd="postfix_precmd" -start_cmd="${name} "'${rc_arg}' -stop_cmd=$start_cmd -reload_cmd=$start_cmd +start_cmd="postfix_op" +stop_cmd="postfix_op" +reload_cmd="postfix_op" extra_commands="reload" : ${spooletcdir=`@PREFIX@/sbin/postconf -h queue_directory`/etc} required_dirs=$spooletcdir @@ -37,5 +38,33 @@ postfix_precmd() done } +postfix_op() +{ + case ${rc_arg} in + start) + for _f in $required_dirs; do + if [ ! -d "${_f}/." ]; then + warn "${_f} is not a directory." + if [ -z $rc_force ]; then + return 1 + fi + fi + done + for _f in $required_files; do + if [ ! -r "${_f}" ]; then + warn "${_f} is not readable." + if [ -z $rc_force ]; then + return 1 + fi + fi + done + ${postfix_command} ${rc_arg} + ;; + *) + ${postfix_command} ${rc_arg} + ;; + esac +} + load_rc_config $name run_rc_command "$1" -- cgit v1.2.3