xref: /freebsd/libexec/rc/rc.d/kdc (revision 8c2f6c3be0125142d3c1782e4b0ee0634c584b9e)
1#!/bin/sh
2#
3#
4
5# PROVIDE: kdc
6# REQUIRE: NETWORKING
7# BEFORE: SERVERS
8# KEYWORD: shutdown
9
10. /etc/rc.subr
11
12name=kdc
13desc="Kerberos 5 server"
14rcvar=${name}_enable
15: ${kdc_restart:="NO"}
16: ${kdc_restart_delay:=""}
17
18set_rcvar_obsolete kerberos5_server_enable kdc_enable
19set_rcvar_obsolete kerberos5_server kdc_program
20set_rcvar_obsolete kerberos5_server_flags kdc_flags
21
22load_rc_config $name
23if [ "${kdc_program}" = /usr/libexec/kdc -o \
24     "${kdc_program}" = /usr/local/libexec/kdc ]; then
25	detach="--detach"
26	flavor=heimdal
27else
28	flavor=mit
29	unset detach
30fi
31
32case ${kdc_restart} in
33[Yy][Ee][Ss])
34	if [ "$flavor" = mit ]; then
35		detach=-n
36	else
37		unset detach
38	fi
39	case ${kdc_restart_delay} in
40	"")	unset daemon_restart_delay;;
41	*)	daemon_restart_delay="-R ${kdc_restart_delay}";;
42	esac
43	command_args="-r ${daemon_restart_delay} ${kdc_program} ${detach} ${command_args}"
44	kdc_program=/usr/sbin/daemon
45	;;
46*)
47	command_args="${detach} ${command_args}"
48	;;
49esac
50
51run_rc_command "$1"
52