#!/bin/sh
#
# PROVIDE: atalkd
# REQUIRE: DAEMON
#
# AppleTalk daemon (netatalk 4.4.1)

. /etc/rc.subr

name="atalkd"
rcvar=$name
command="/usr/pkg/sbin/atalkd"
pidfile="/var/run/${name}.pid"
register="/usr/pkg/bin/nbprgstr"
myhostname=`hostname|sed 's/\..*$//'`
required_files="/usr/pkg/etc/netatalk/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"
