Merge from vendor branch LIBSTDC++:
[dragonfly.git] / etc / rc.d / amd
1 #!/bin/sh
2 #
3 # $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
4 # $FreeBSD: src/etc/rc.d/amd,v 1.9 2002/10/12 10:31:31 schweikh Exp $
5 # $DragonFly: src/etc/rc.d/amd,v 1.2 2003/11/19 10:32:45 eirikn Exp $
6 #
7
8 # PROVIDE: amd
9 # REQUIRE: rpcbind mountall ypbind nfsclient
10 # BEFORE: DAEMON
11 # KEYWORD: DragonFly FreeBSD NetBSD 
12
13 . /etc/rc.subr
14
15 name="amd"
16 rcvar=`set_rcvar`
17 command="/usr/sbin/${name}"
18
19 case ${OSTYPE} in
20 DragonFly)
21         start_precmd="amd_precmd"
22         command_args="&"
23         ;;
24 FreeBSD)
25         start_precmd="amd_precmd"
26         command_args="&"
27         ;;
28 NetBSD)
29         command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid'
30         required_dirs="$amd_dir"
31         required_files="/etc/amd.conf"
32         required_vars="rpcbind"
33         ;;
34 esac
35
36 amd_precmd()
37 {
38         case ${OSTYPE} in
39         DragonFly)
40                 if ! checkyesno nfs_client_enable; then
41                         force_depend nfsclient || return 1
42                 fi
43
44                 if ! checkyesno rpcbind_enable  && \
45                         ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
46                         then
47                                 force_depend rpcbind || return 1
48                 fi
49
50                 case ${amd_map_program} in
51                         [Nn][Oo] | '')
52                         ;;
53                 *)
54                         rc_flags="${rc_flags} `eval ${amd_map_program}`"
55                         ;;
56                 esac
57
58                 case "${amd_flags}" in
59                         '')
60                         if [ ! -r /etc/amd.conf ]; then
61                                 warn 'amd will not load without arguments'
62                                 return 1
63                         fi
64                         ;;
65                 esac
66         ;;
67
68         FreeBSD)
69                 if ! checkyesno nfs_client_enable; then
70                         force_depend nfsclient || return 1
71                 fi
72
73                 if ! checkyesno rpcbind_enable  && \
74                     ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
75                 then
76                         force_depend rpcbind || return 1
77                 fi
78
79                 case ${amd_map_program} in
80                 [Nn][Oo] | '')
81                         ;;
82                 *)
83                         rc_flags="${rc_flags} `eval ${amd_map_program}`"
84                         ;;
85                 esac
86
87                 case "${amd_flags}" in
88                 '')
89                         if [ ! -r /etc/amd.conf ]; then
90                                 warn 'amd will not load without arguments'
91                                 return 1
92                         fi
93                         ;;
94                 esac
95                 ;;
96         esac
97         return 0
98 }
99
100 load_rc_config $name
101 run_rc_command "$1"