* Add DragonFly as an possibility to a case statement.
[dragonfly.git] / etc / rc.d / ypserv
1 #!/bin/sh
2 #
3 # $NetBSD: ypserv,v 1.5 2000/09/19 13:04:39 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/ypserv,v 1.7 2003/07/09 03:21:03 mtm Exp $
5 # $DragonFly: src/etc/rc.d/ypserv,v 1.3 2003/11/19 12:49:07 eirikn Exp $
6 #
7
8 # PROVIDE: ypserv
9 # REQUIRE: rpcbind
10 # KEYWORD: DragonFly FreeBSD NetBSD
11
12 . /etc/rc.subr
13
14 name="ypserv"
15 command="/usr/sbin/${name}"
16 start_precmd="ypserv_precmd"
17
18 load_rc_config $name
19 case ${OSTYPE} in
20 DragonFly)
21         rcvar="nis_server_enable"
22         command_args="${nis_server_flags}"
23         ;;
24 FreeBSD)
25         rcvar="nis_server_enable"
26         command_args="${nis_server_flags}"
27         ;;
28 NetBSD)
29         rcvar=${name}
30         required_vars="rpcbind"
31         ;;
32 esac
33
34 ypserv_precmd()
35 {
36         case ${OSTYPE} in
37         DragonFly)
38                 if ! checkyesno rpcbind_enable  && \
39                 ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
40                 then
41                         force_depend rpcbind || return 1
42                 fi
43                 ;;
44         FreeBSD)
45                 if ! checkyesno rpcbind_enable  && \
46                     ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
47                 then
48                         force_depend rpcbind || return 1
49                 fi
50                 ;;
51         esac
52
53         _domain=`domainname`
54         if [ -z "$_domain" ]; then
55                 warn "NIS domainname(1) is not set."
56                 return 1
57         fi
58
59         if [ ! -d /var/yp/$_domain/. ]; then
60                 warn "/var/yp/$_domain is not a directory."
61                 return 1
62         fi
63 }
64
65 run_rc_command "$1"