pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mail/postfix/files Don't hardcode directories... inste...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ecca7047d9f0
branches:  trunk
changeset: 478229:ecca7047d9f0
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Mon Jul 19 22:02:15 2004 +0000

description:
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:

 mail/postfix/files/postfix.sh |  39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diffs (62 lines):

diff -r 37226f082cc3 -r ecca7047d9f0 mail/postfix/files/postfix.sh
--- a/mail/postfix/files/postfix.sh     Mon Jul 19 21:09:54 2004 +0000
+++ b/mail/postfix/files/postfix.sh     Mon Jul 19 22:02:15 2004 +0000
@@ -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 @@
        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"



Home | Main Index | Thread Index | Old Index