#!/bin/sh
#
# PROVIDE: atalkd
# REQUIRE: DAEMON
#
# AppleTalk daemons. Make sure not to start atalkd in the background:
# its data structures must have time to stablize before running the
# other processes.
#

. /etc/rc.subr

name="atalkd"
rcvar=$name
command=":SBINDIR:/atalkd"
pidfile="/var/run/${name}.pid"
register=":BINDIR:/nbprgstr"
myhostname=`hostname|sed 's/\..*$//'`
required_files=":ETCDIR:/atalkd.conf $register"

start_cmd="atalkd_start"

atalkd_start()
{
	if [ -x $command ]; then
		echo 'Starting atalkd.'
		$command $command_args
	fi

	if [ -x $register ]; then
               echo 'Setting AppleTalk info with nbprgstr.'
        	$register -p 4 $myhostname:Workstation
        	$register -p 4 $myhostname:netatalk
	fi
}

load_rc_config $name
run_rc_command "$1"

