1 1.1 thorpej #!/bin/sh 2 1.1 thorpej # 3 1.9 mycroft # $NetBSD: postfix,v 1.9 2004/08/13 18:08:03 mycroft Exp $ 4 1.1 thorpej # 5 1.1 thorpej 6 1.1 thorpej # PROVIDE: mail 7 1.1 thorpej # REQUIRE: LOGIN 8 1.6 lukem # we make mail start late, so that things like .forward's are not 9 1.6 lukem # processed until the system is fully operational 10 1.1 thorpej 11 1.9 mycroft $_rc_subr_loaded . /etc/rc.subr 12 1.1 thorpej 13 1.3 lukem name="postfix" 14 1.5 lukem rcvar=$name 15 1.8 lukem postfix_command="/usr/sbin/${name}" 16 1.3 lukem required_files="/etc/${name}/main.cf" 17 1.6 lukem start_precmd="postfix_precmd" 18 1.8 lukem start_cmd="postfix_op" 19 1.8 lukem stop_cmd="postfix_op" 20 1.8 lukem reload_cmd="postfix_op" 21 1.5 lukem extra_commands="reload" 22 1.6 lukem spooletcdir="/var/spool/${name}/etc" 23 1.6 lukem required_dirs=$spooletcdir 24 1.6 lukem 25 1.6 lukem postfix_precmd() 26 1.6 lukem { 27 1.6 lukem # As this is called after the is_running and required_dir checks 28 1.6 lukem # are made in run_rc_command(), we can safely assume ${spooletcdir} 29 1.6 lukem # exists and postfix isn't running at this point (unless forcestart 30 1.6 lukem # is used). 31 1.6 lukem # 32 1.6 lukem 33 1.6 lukem for f in localtime resolv.conf services; do 34 1.6 lukem if [ -f /etc/$f ]; then 35 1.6 lukem cmp -s /etc/$f ${spooletcdir}/$f || \ 36 1.6 lukem cp -p /etc/$f ${spooletcdir}/$f 37 1.6 lukem fi 38 1.6 lukem done 39 1.6 lukem } 40 1.1 thorpej 41 1.8 lukem postfix_op() 42 1.8 lukem { 43 1.8 lukem ${postfix_command} ${rc_arg} 44 1.8 lukem } 45 1.8 lukem 46 1.4 lukem load_rc_config $name 47 1.3 lukem run_rc_command "$1" 48