Blob Blame History Raw
#!/bin/sh
# chkconfig: - 91 35
# description: This package enables Linux to talk to Macintosh computers via the \
#              AppleTalk networking protocol. It includes a daemon to allow Linux \
#              to act as a file server over EtherTalk or IP for Mac's.
# processname: atalkd
# pidfile: /var/run/atalkd.pid
# config: /etc/atalk/*

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Source Appletalk configuration
. /etc/atalk/netatalk.conf

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

start() {
	echo -n $"Starting AppleTalk services: "
	if [ ${ATALK_BGROUND} = yes ] ; then
	    echo -n "(backgrounded)"
	    {
		daemon atalkd -f /etc/atalk/atalkd.conf
		nbprgstr -p 4 "${ATALK_NAME}:Workstation"
		nbprgstr -p 4 "${ATALK_NAME}:netatalk"
		if [ ${PAPD_RUN} = yes ] ; then
		    daemon papd -f /etc/atalk/papd.conf
		fi
		if [ ${AFPD_RUN} = yes ] ; then
		    daemon afpd -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}\" -f /etc/atalk/AppleVolumes.default -s /etc/atalk/AppleVolumes.system
		fi
	    } >/dev/null &
	else
	    daemon atalkd -f /etc/atalk/atalkd.conf
	    nbprgstr -p 4 "${ATALK_NAME}:Workstation"
	    nbprgstr -p 4 "${ATALK_NAME}:netatalk"
	    if [ ${PAPD_RUN} = yes ] ; then
		daemon papd -f /etc/atalk/papd.conf
	    fi
	    if [ ${AFPD_RUN} = yes ] ; then
		daemon afpd -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}\" -f /etc/atalk/AppleVolumes.default -s /etc/atalk/AppleVolumes.system
	    fi
	fi
	echo
	touch /var/lock/subsys/atalk
}
  
stop() {
	echo -n $"Shutting down AppleTalk services: "
	killproc afpd
	killproc papd
	nbpunrgstr "${ATALK_NAME}:Workstation@*"
	nbpunrgstr "${ATALK_NAME}:netatalk@*"
	killproc atalkd
	# Attempt to zap the module, so that we can restart the
	# Appletalk daemons cleanly
	if [ -e /proc/modules ] && [ -x /sbin/modprobe ] ; then
	    modprobe -r appletalk
	fi
	rm -f /var/lock/subsys/atalk
	echo ""
}


restart() {
	stop
	start
}

case "$1" in
    start)
	start	
	;;
    stop)
	stop
	;;
    restart|reload)
	restart
	;;
    condrestart)
    [ -f /var/lock/subsys/atalk ] && restart || : 
     ;;
    status)
	status atalkd
	;;
    *)
	echo $"Usage: $0 {start|stop|restart|status|condrestart}"
	exit 1
esac

exit 0