xref: /dragonfly/etc/rc.d/yppasswdd (revision 9dbf638f)
1#!/bin/sh
2#
3# $NetBSD: yppasswdd,v 1.6 2002/03/22 04:34:01 thorpej Exp $
4# $FreeBSD: src/etc/rc.d/yppasswdd,v 1.7 2003/07/09 03:21:03 mtm Exp $
5# $DragonFly: src/etc/rc.d/yppasswdd,v 1.1 2003/07/24 06:35:37 dillon Exp $
6#
7
8# PROVIDE: yppasswdd
9# REQUIRE: ypserv ypbind
10# BEFORE:  LOGIN
11# KEYWORD: DragonFly FreeBSD NetBSD
12
13. /etc/rc.subr
14
15name="yppasswdd"
16command="/usr/sbin/rpc.${name}"
17start_precmd="yppasswdd_precmd"
18
19load_rc_config $name
20case ${OSTYPE} in
21DragonFly)
22	rcvar="nis_yppasswdd_enable"
23        command_args="${nis_yppasswdd_flags}"
24        ;;
25
26FreeBSD)
27	rcvar="nis_yppasswdd_enable"
28	command_args="${nis_yppasswdd_flags}"
29	;;
30NetBSD)
31	rcvar=$name
32	required_vars="rpcbind ypserv"
33	;;
34esac
35
36yppasswdd_precmd()
37{
38	case ${OSTYPE} in
39	DragonFly)
40		if ! checkyesno rpcbind_enable  && \
41                    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
42                then
43                        force_depend rpcbind || return 1
44                fi
45                if ! checkyesno nis_server_enable && \
46                    ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
47                then
48                        force_depend ypserv || return 1
49                fi
50                ;;
51
52	FreeBSD)
53		if ! checkyesno rpcbind_enable  && \
54		    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
55		then
56			force_depend rpcbind || return 1
57		fi
58		if ! checkyesno nis_server_enable && \
59		    ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
60		then
61			force_depend ypserv || return 1
62		fi
63		;;
64	esac
65
66	_domain=`domainname`
67	if [ -z "$_domain" ]; then
68		warn "NIS domainname(1) is not set."
69		return 1
70	fi
71}
72
73run_rc_command "$1"
74