* Add DragonFly as an possibility to a case statement.
[dragonfly.git] / etc / rc.d / yppasswdd
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
15 name="yppasswdd"
16 command="/usr/sbin/rpc.${name}"
17 start_precmd="yppasswdd_precmd"
18
19 load_rc_config $name
20 case ${OSTYPE} in
21 DragonFly)
22         rcvar="nis_yppasswdd_enable"
23         command_args="${nis_yppasswdd_flags}"
24         ;;
25 FreeBSD)
26         rcvar="nis_yppasswdd_enable"
27         command_args="${nis_yppasswdd_flags}"
28         ;;
29 NetBSD)
30         rcvar=$name
31         required_vars="rpcbind ypserv"
32         ;;
33 esac
34
35 yppasswdd_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
71 run_rc_command "$1"