amd revision 126636
1179055Sjfv#!/bin/sh
2171384Sjfv#
3205919Sjfv# $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
4179055Sjfv# $FreeBSD: head/etc/rc.d/amd 126636 2004-03-05 07:43:38Z mtm $
5179055Sjfv#
6179055Sjfv
7179055Sjfv# PROVIDE: amd
8179055Sjfv# REQUIRE: rpcbind ypbind nfsclient
9179055Sjfv# BEFORE: DAEMON
10179055Sjfv# KEYWORD: FreeBSD
11179055Sjfv
12179055Sjfv. /etc/rc.subr
13179055Sjfv
14179055Sjfvname="amd"
15179055Sjfvrcvar=`set_rcvar`
16179055Sjfvcommand="/usr/sbin/${name}"
17179055Sjfvstart_precmd="amd_precmd"
18179055Sjfvcommand_args="&"
19179055Sjfv
20179055Sjfvamd_precmd()
21179055Sjfv{
22179055Sjfv	if ! checkyesno nfs_client_enable; then
23179055Sjfv		force_depend nfsclient || return 1
24179055Sjfv	fi
25179055Sjfv
26179055Sjfv	if ! checkyesno rpcbind_enable  && \
27179055Sjfv	    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
28179055Sjfv	then
29179055Sjfv		force_depend rpcbind || return 1
30179055Sjfv	fi
31171384Sjfv
32179055Sjfv	case ${amd_map_program} in
33179055Sjfv	[Nn][Oo] | '')
34171384Sjfv		;;
35171384Sjfv	*)
36171384Sjfv		rc_flags="${rc_flags} `eval ${amd_map_program}`"
37171384Sjfv		;;
38171384Sjfv	esac
39171412Sjfv
40171384Sjfv	case "${amd_flags}" in
41171384Sjfv	'')
42171384Sjfv		if [ ! -r /etc/amd.conf ]; then
43171384Sjfv			warn 'amd will not load without arguments'
44171384Sjfv			return 1
45171384Sjfv		fi
46171384Sjfv		;;
47171384Sjfv	*)
48171384Sjfv		rc_flags="-p ${rc_flags} > /var/run/amd.pid 2> /dev/null" \
49208762Sjfv		;;
50171384Sjfv	esac
51171384Sjfv	return 0
52171384Sjfv}
53171384Sjfv
54171384Sjfvload_rc_config $name
55171384Sjfvrun_rc_command "$1"
56171384Sjfv