Source-Changes-HG archive

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

[src/trunk]: src/etc/rc.d populate /var/spool/postfix/etc with /etc/{localtim...



details:   https://anonhg.NetBSD.org/src/rev/2a9310cfbc8d
branches:  trunk
changeset: 522182:2a9310cfbc8d
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Feb 12 02:19:27 2002 +0000

description:
populate /var/spool/postfix/etc with /etc/{localtime,resolv.conf,services}.
per suggestion from perry.

diffstat:

 etc/rc.d/postfix |  33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r 77d852b4b22a -r 2a9310cfbc8d etc/rc.d/postfix
--- a/etc/rc.d/postfix  Tue Feb 12 02:09:12 2002 +0000
+++ b/etc/rc.d/postfix  Tue Feb 12 02:19:27 2002 +0000
@@ -1,24 +1,41 @@
 #!/bin/sh
 #
-# $NetBSD: postfix,v 1.5 2000/09/19 13:04:39 lukem Exp $
+# $NetBSD: postfix,v 1.6 2002/02/12 02:19:27 lukem Exp $
 #
 
 # PROVIDE: mail
 # REQUIRE: LOGIN
-
-#      we could do this, but make mail start late, so that things like
-#      .forward's are not processed until the system is fully operational
-## REQUIRE: DAEMON
+#      we make mail start late, so that things like .forward's are not
+#      processed until the system is fully operational
 
 . /etc/rc.subr
 
 name="postfix"
 rcvar=$name
 required_files="/etc/${name}/main.cf"
-start_cmd="postfix start"
-stop_cmd="postfix stop"
-reload_cmd="postfix reload"
+start_precmd="postfix_precmd"
+start_cmd="${name} start"
+stop_cmd="${name} stop"
+reload_cmd="${name} reload"
 extra_commands="reload"
+spooletcdir="/var/spool/${name}/etc"
+required_dirs=$spooletcdir
+
+postfix_precmd()
+{
+       # As this is called after the is_running and required_dir checks
+       # are made in run_rc_command(), we can safely assume ${spooletcdir}
+       # exists and postfix isn't running at this point (unless forcestart
+       # is used).
+       #
+
+       for f in localtime resolv.conf services; do
+               if [ -f /etc/$f ]; then
+                       cmp -s /etc/$f ${spooletcdir}/$f || \
+                           cp -p /etc/$f ${spooletcdir}/$f
+               fi
+       done
+}
 
 load_rc_config $name
 run_rc_command "$1"



Home | Main Index | Thread Index | Old Index