3 # description: This package enables Linux to talk to Macintosh
4 # computers via the AppleTalk networking protocol and
5 # provides printer, file sharing, and AppleTalk routing
8 # AppleTalk daemons. Make sure not to start atalkd in the background:
9 # its data structures must have time to stablize before running the
13 ATALK_CONF_DIR=:ETCDIR:
16 # Source function library.
17 . /etc/rc.d/init.d/functions
19 # Source networking configuration.
20 . /etc/sysconfig/network
22 # Quickly probe for appletalk and warn if we can't find it
23 /sbin/modprobe appletalk || echo "[could not load appletalk module]"
25 # Check for IP Encapsulation support
26 #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]"
28 if [ ! -x ${ATALK_SBIN}/atalkd ]; then
29 echo "[${ATALK_SBIN}/atalkd not found. Did it compile?]";
33 if [ ! -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
34 echo "[${ATALK_CONF_DIR}/netatalk.conf not found]";
38 # read in netatalk configuration
39 . ${ATALK_CONF_DIR}/netatalk.conf
41 # Check that networking is up.
42 if [ ${NETWORKING} = "no" ]; then
43 echo "[Network isn't started]";
47 # initialize return values
53 # startup code for everything
55 if [ x"${ATALKD_RUN}" != x"no" ]; then
56 echo -n " Starting atalkd:"
57 daemon ${ATALK_SBIN}/atalkd
61 if [ -x ${ATALK_BIN}/nbprgstr ]; then
62 action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
63 action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
66 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
67 echo -n " Starting papd:"
68 daemon ${ATALK_SBIN}/papd
73 # check for timelord in bin directory
74 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
75 echo -n " Starting timelord"
76 daemon ${ATALK_BIN}/timelord
80 # check for timelord in sbin directory
81 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
82 echo -n " Starting timelord"
83 daemon ${ATALK_SBIN}/timelord
89 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
90 echo -n " Starting afpd:"
91 daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
92 -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
97 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
99 touch /var/lock/subsys/atalk || RETVAL=1
105 echo -n 'Starting AppleTalk services: '
106 if [ x"${ATALK_BGROUND}" = x"yes" ]; then
107 echo -n "(backgrounded)"
108 atalk_startup >& /dev/null &
116 echo 'Shutting down AppleTalk services: '
117 if [ x"${ATALKD_RUN}" != x"no" ]; then
118 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
119 echo -n " Stopping papd:"
125 # checking for timelord in bin directory
126 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
127 echo -n " Stopping timelord:"
132 # checking for timelord in sbin directory
133 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
134 echo -n " Stopping timelord:"
139 action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
140 action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
142 # kill atalkd last, since without it the plumbing goes away.
143 if [ -x ${ATALK_SBIN}/atalkd ]; then
144 echo -n " Stopping atalk:"
151 # kill this separately as we also do AFP/tcp
152 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
153 echo -n " Stopping afpd:"
159 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
161 rm -f /var/lock/subsys/atalk || RETVAL=1
175 echo "Usage: atalk {start|stop|restart|status}"