xref: /dragonfly/etc/rc.d/yppasswdd (revision 4e7eb5cc)
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.2 2003/11/19 10:32:45 eirikn 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	;;
25FreeBSD)
26	rcvar="nis_yppasswdd_enable"
27	command_args="${nis_yppasswdd_flags}"
28	;;
29NetBSD)
30	rcvar=$name
31	required_vars="rpcbind ypserv"
32	;;
33esac
34
35yppasswdd_precmd()
36{
37	case ${OSTYPE} in
38	DragonFly)
39		if ! checkyesno rpcbind_enable  && \
40		! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
41		then
42			force_depend rpcbind || return 1
43		fi
44		if ! checkyesno nis_server_enable && \
45		! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
46		then
47			force_depend ypserv || return 1
48		fi
49		;;
50	FreeBSD)
51		if ! checkyesno rpcbind_enable  && \
52		    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
53		then
54			force_depend rpcbind || return 1
55		fi
56		if ! checkyesno nis_server_enable && \
57		    ! /etc/rc.d/ypserv forcestatus 1>/dev/null 2>&1
58		then
59			force_depend ypserv || return 1
60		fi
61		;;
62	esac
63
64	_domain=`domainname`
65	if [ -z "$_domain" ]; then
66		warn "NIS domainname(1) is not set."
67		return 1
68	fi
69}
70
71run_rc_command "$1"
72