amd revision 98774
150476Speter#!/bin/sh
226419Sache#
326419Sache# $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
426419Sache# $FreeBSD: head/etc/rc.d/amd 98774 2002-06-24 19:50:56Z jdp $
526419Sache#
626419Sache
726419Sache# PROVIDE: amd
836307Sphk# REQUIRE: rpcbind mountall ypbind nfsclient
936307Sphk# BEFORE: DAEMON
1036307Sphk# KEYWORD: FreeBSD NetBSD
1136307Sphk
1236307Sphk. /etc/rc.subr
1336307Sphk
1436307Sphkname="amd"
1536307Sphkrcvar=`set_rcvar`
1636307Sphkcommand="/usr/sbin/${name}"
1736307Sphk
1836307Sphkcase `${CMD_OSTYPE}` in
1936307SphkFreeBSD)
2026419Sache	start_precmd="amd_precmd"
2126419Sache	command_args="&"
2226419Sache	;;
2336307SphkNetBSD)
2436307Sphk	command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid'
2536307Sphk	required_dirs="$amd_dir"
2636307Sphk	required_files="/etc/amd.conf"
2736307Sphk	required_vars="rpcbind"
2836307Sphk	;;
2936307Sphkesac
3036307Sphk
3136307Sphkamd_precmd() 
3236307Sphk{
3336307Sphk	case `${CMD_OSTYPE}` in
3436307Sphk	FreeBSD)
3526419Sache		if ! checkyesno nfs_client_enable ; then
3626419Sache			force_depend nfsclient || return 1
3726419Sache		fi
3836307Sphk
3936307Sphk		if ! checkyesno portmap_enable  && \
4036307Sphk		    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
4136307Sphk                then
4236307Sphk			force_depend rpcbind || return 1
4336307Sphk		fi
4436307Sphk
4526419Sache		case ${amd_map_program} in
4626419Sache		[Nn][Oo] | '')
4726419Sache			;;
4836307Sphk		*)
4936307Sphk			amd_flags="${amd_flags} `eval ${amd_map_program}`"
5036307Sphk			;;
5136307Sphk		esac
5236307Sphk
5336307Sphk		case "${amd_flags}" in
5436307Sphk		'')
5526419Sache			if [ ! -r /etc/amd.conf ]; then
5626419Sache				warn 'amd will not load without arguments'
5726419Sache				return 1
5826419Sache			fi
5926419Sache			;;
6026419Sache		*)
6126419Sache			amd_flags="-p ${amd_flags} > /var/run/amd.pid 2> /dev/null" \
6226419Sache			;;
6326419Sache		esac
6426419Sache		;;
6526419Sache	esac
6654090Sache	return 0
6726419Sache}
6826419Sache
6926419Sacheload_rc_config $name
7026419Sacherun_rc_command "$1"
7126419Sache