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 if [ ! -x ${ATALK_SBIN}/atalkd ]; then
23 # Quickly probe for appletalk and warn if we can't find it
24 #/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]"
27 echo "[${ATALK_SBIN}/atalkd not found. Did it compile?]";
31 if [ ! -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
32 echo "[${ATALK_CONF_DIR}/netatalk.conf not found]";
36 # read in netatalk configuration
37 . ${ATALK_CONF_DIR}/netatalk.conf
39 # Check that networking is up.
40 if [ ${NETWORKING} = "no" ]; then
41 echo "[Network isn't started]";
45 # initialize return values
52 # startup code for everything
54 if [ x"${ATALKD_RUN}" != x"no" ]; then
55 echo -n " Starting atalkd:"
56 daemon ${ATALK_SBIN}/atalkd
60 if [ -x ${ATALK_BIN}/nbprgstr ]; then
61 action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
62 action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
65 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
66 echo -n " Starting papd:"
67 daemon ${ATALK_SBIN}/papd
72 # check for timelord in bin directory
73 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
74 echo -n " Starting timelord"
75 daemon ${ATALK_BIN}/timelord
79 # check for timelord in sbin directory
80 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
81 echo -n " Starting timelord"
82 daemon ${ATALK_SBIN}/timelord
86 # check for a2boot in bin directory
87 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
88 echo -n " Starting a2boot"
89 daemon ${ATALK_BIN}/a2boot
93 # check for a2boot in sbin directory
94 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
95 echo -n " Starting a2boot"
96 daemon ${ATALK_SBIN}/a2boot
102 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ] ; then
103 echo -n " Starting cnid_metad:"
104 daemon ${ATALK_SBIN}/cnid_metad $CNID_CONFIG
109 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
110 echo -n " Starting afpd:"
111 daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
112 -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
117 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
119 touch /var/lock/subsys/atalk || RETVAL=1
125 echo -n 'Starting AppleTalk services: '
126 if [ x"${ATALK_BGROUND}" = x"yes" ]; then
127 echo -n "(backgrounded)"
128 atalk_startup >& /dev/null &
136 echo 'Shutting down AppleTalk services: '
137 if [ x"${ATALKD_RUN}" != x"no" ]; then
138 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
139 echo -n " Stopping papd:"
145 # checking for timelord in bin directory
146 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
147 echo -n " Stopping timelord:"
152 # checking for timelord in sbin directory
153 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
154 echo -n " Stopping timelord:"
159 # checking for a2boot in bin directory
160 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
161 echo -n " Stopping a2boot:"
166 # checking for a2boot in sbin directory
167 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
168 echo -n " Stopping a2boot:"
173 action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
174 action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
176 # kill atalkd last, since without it the plumbing goes away.
177 if [ -x ${ATALK_SBIN}/atalkd ]; then
178 echo -n " Stopping atalk:"
185 # kill this separately as we also do AFP/tcp
186 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
187 echo -n " Stopping afpd:"
193 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
194 echo -n " Stopping cnid_metad:"
200 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
202 rm -f /var/lock/subsys/atalk || RETVAL=1
216 echo "Usage: atalk {start|stop|restart|status}"