summaryrefslogtreecommitdiff
path: root/mail/postfix/files/postfix.sh
blob: 46a49eae606be8efa08ac9b5ee6dd72b81f9b65d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: postfix.sh,v 1.3 2004/07/19 04:51:07 jlam Exp $
#

# PROVIDE: mail
# REQUIRE: LOGIN
#	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="@PKG_SYSCONFDIR@/main.cf"
start_precmd="postfix_precmd"
start_cmd="${name} "'${rc_arg}'
stop_cmd=$start_cmd
reload_cmd=$start_cmd
extra_commands="reload"
: ${spooletcdir=`@PREFIX@/sbin/postconf -h queue_directory`/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"