$NetBSD: patch-bg,v 1.5 2001/05/24 17:00:58 abs Exp $ --- rc.atalk.bsd.orig Mon Aug 25 23:00:54 1997 +++ rc.atalk.bsd @@ -1,39 +1,69 @@ +#!/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. # -# -# SUNOS: UNCOMMENT THESE LINES TO LOAD THE KERNEL MODULE. Note that -# modunload-ing netatalk may cause your machine to panic or hang. -# -##echo -n 'loading netatalk: ' -##if [ -f :ETCDIR:/netatalk.o ]; then -## /usr/etc/modload -sym :ETCDIR:/netatalk.o; -##fi - -echo -n 'starting appletalk daemons:' -if [ -x :SBINDIR:/atalkd ]; then - :SBINDIR:/atalkd; echo -n ' atalkd' -fi - -if [ -x :BINDIR:/nbprgstr ]; then - :BINDIR:/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:Workstation - :BINDIR:/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:netatalk - echo -n ' nbprgstr' -fi - -if [ -x :SBINDIR:/papd ]; then - :SBINDIR:/papd; echo -n ' papd' -fi - -if [ -x :SBINDIR:/afpd ]; then - :SBINDIR:/afpd; echo -n ' afpd' -fi - -if [ -x :SBINDIR:/timelord ]; then - :SBINDIR:/timelord; echo -n ' timelord' -fi - - echo '.' +papd=:LIBEXECDIR:/papd +afpd=:LIBEXECDIR:/afpd +atalkd=:LIBEXECDIR:/atalkd +register=:BINDIR:/nbprgstr + +piddir=/var/run/ +machine_name=`hostname -s |sed 's/\..*$//'` +afpd_args= +papd_args= +atalkd_args= + +cmd=${1:-start} + +case ${cmd} in +start) + if [ -x ${atalkd} ]; then + echo 'Starting atalkd.' + ${atalkd} ${atalkd_args} + fi + + if [ -x ${register} ]; then + ${register} -p 4 ${machine_name}:Workstation + ${register} -p 4 ${machine_name}:netatalk + fi + + if [ -x ${papd} -a -e :ETCDIR:/papd.conf ]; then + echo 'Starting papd.' + ${papd} ${papd_args} + fi + + if [ -x ${afpd} -a -e :ETCDIR:/AppleVolumes.system ]; then + echo 'Starting afpd.' + ${afpd} ${afpd_args} + fi + ;; +stop) + if [ -f ${piddir}afpd.pid ]; then + echo "Stopping afpd." + kill `cat ${piddir}afpd.pid` + fi + if [ -f ${piddir}papd.pid ]; then + echo "Stopping papd." + kill `cat ${piddir}papd.pid` + fi + if [ -f ${piddir}atalkd.pid ]; then + echo "Stopping atalkd." + kill `cat ${piddir}atalkd.pid` + fi + ;; +restart) + ( $0 stop ) + sleep 5 + $0 start + ;; +*) + echo "Unexpected argument: ${cmd}" + ;; +esac +exit 0