summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2004-07-19 22:02:15 +0000
committerjlam <jlam@pkgsrc.org>2004-07-19 22:02:15 +0000
commit0572483cd9987cd38dee2e82b9e53b759a0749d2 (patch)
tree3806dacaf0da5f376c8654b0ee371b96b4f874b7 /mail
parent8051480f6072ed662323dbfbc93c69a9a3eef99d (diff)
downloadpkgsrc-0572483cd9987cd38dee2e82b9e53b759a0749d2.tar.gz
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.
Diffstat (limited to 'mail')
-rw-r--r--mail/postfix/files/postfix.sh39
1 files changed, 34 insertions, 5 deletions
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"