amd revision 104980
1164190Sjkoshy#!/bin/sh
2164190Sjkoshy#
3164190Sjkoshy# $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
4164190Sjkoshy# $FreeBSD: head/etc/rc.d/amd 104980 2002-10-12 10:31:31Z schweikh $
5164190Sjkoshy#
6164190Sjkoshy
7164190Sjkoshy# PROVIDE: amd
8164190Sjkoshy# REQUIRE: rpcbind mountall ypbind nfsclient
9164190Sjkoshy# BEFORE: DAEMON
10164190Sjkoshy# KEYWORD: FreeBSD NetBSD
11164190Sjkoshy
12164190Sjkoshy. /etc/rc.subr
13164190Sjkoshy
14164190Sjkoshyname="amd"
15164190Sjkoshyrcvar=`set_rcvar`
16164190Sjkoshycommand="/usr/sbin/${name}"
17164190Sjkoshy
18164190Sjkoshycase ${OSTYPE} in
19164190SjkoshyFreeBSD)
20164190Sjkoshy	start_precmd="amd_precmd"
21164190Sjkoshy	command_args="&"
22164190Sjkoshy	;;
23164190SjkoshyNetBSD)
24164190Sjkoshy	command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid'
25164190Sjkoshy	required_dirs="$amd_dir"
26164190Sjkoshy	required_files="/etc/amd.conf"
27164190Sjkoshy	required_vars="rpcbind"
28164190Sjkoshy	;;
29164190Sjkoshyesac
30164190Sjkoshy
31164190Sjkoshyamd_precmd()
32164190Sjkoshy{
33164190Sjkoshy	case ${OSTYPE} in
34164190Sjkoshy	FreeBSD)
35164190Sjkoshy		if ! checkyesno nfs_client_enable; then
36164190Sjkoshy			force_depend nfsclient || return 1
37164190Sjkoshy		fi
38164190Sjkoshy
39164190Sjkoshy		if ! checkyesno rpcbind_enable  && \
40164190Sjkoshy		    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
41164190Sjkoshy		then
42164190Sjkoshy			force_depend rpcbind || return 1
43164190Sjkoshy		fi
44164190Sjkoshy
45164190Sjkoshy		case ${amd_map_program} in
46164190Sjkoshy		[Nn][Oo] | '')
47164190Sjkoshy			;;
48210338Skaiw		*)
49164190Sjkoshy			rc_flags="${rc_flags} `eval ${amd_map_program}`"
50164190Sjkoshy			;;
51164190Sjkoshy		esac
52164190Sjkoshy
53164190Sjkoshy		case "${amd_flags}" in
54164190Sjkoshy		'')
55164190Sjkoshy			if [ ! -r /etc/amd.conf ]; then
56164190Sjkoshy				warn 'amd will not load without arguments'
57164190Sjkoshy				return 1
58164190Sjkoshy			fi
59164190Sjkoshy			;;
60164190Sjkoshy		*)
61164190Sjkoshy			rc_flags="-p ${rc_flags} > /var/run/amd.pid 2> /dev/null" \
62164190Sjkoshy			;;
63164190Sjkoshy		esac
64164190Sjkoshy		;;
65164190Sjkoshy	esac
66164190Sjkoshy	return 0
67164190Sjkoshy}
68164190Sjkoshy
69165535Sjkoshyload_rc_config $name
70165535Sjkoshyrun_rc_command "$1"
71164190Sjkoshy