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
54 # startup code for everything
56 if [ x"${ATALKD_RUN}" != x"no" ]; then
57 echo -n " Starting atalkd:"
58 daemon ${ATALK_SBIN}/atalkd
62 if [ -x ${ATALK_BIN}/nbprgstr ]; then
63 action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
64 action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
67 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
68 echo -n " Starting papd:"
69 daemon ${ATALK_SBIN}/papd
74 # check for timelord in bin directory
75 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
76 echo -n " Starting timelord"
77 daemon ${ATALK_BIN}/timelord
81 # check for timelord in sbin directory
82 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
83 echo -n " Starting timelord"
84 daemon ${ATALK_SBIN}/timelord
88 # check for a2boot in bin directory
89 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
90 echo -n " Starting a2boot"
91 daemon ${ATALK_BIN}/a2boot
95 # check for a2boot in sbin directory
96 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
97 echo -n " Starting a2boot"
98 daemon ${ATALK_SBIN}/a2boot
104 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ] ; then
105 echo -n " Starting cnid_metad:"
106 daemon ${ATALK_SBIN}/cnid_metad
111 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
112 echo -n " Starting afpd:"
113 daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
114 -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
119 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
121 touch /var/lock/subsys/atalk || RETVAL=1
127 echo -n 'Starting AppleTalk services: '
128 if [ x"${ATALK_BGROUND}" = x"yes" ]; then
129 echo -n "(backgrounded)"
130 atalk_startup >& /dev/null &
138 echo 'Shutting down AppleTalk services: '
139 if [ x"${ATALKD_RUN}" != x"no" ]; then
140 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
141 echo -n " Stopping papd:"
147 # checking for timelord in bin directory
148 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
149 echo -n " Stopping timelord:"
154 # checking for timelord in sbin directory
155 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
156 echo -n " Stopping timelord:"
161 # checking for a2boot in bin directory
162 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
163 echo -n " Stopping a2boot:"
168 # checking for a2boot in sbin directory
169 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
170 echo -n " Stopping a2boot:"
175 action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
176 action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
178 # kill atalkd last, since without it the plumbing goes away.
179 if [ -x ${ATALK_SBIN}/atalkd ]; then
180 echo -n " Stopping atalk:"
187 # kill this separately as we also do AFP/tcp
188 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
189 echo -n " Stopping afpd:"
195 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
196 echo -n " Stopping cnid_metad:"
202 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
204 rm -f /var/lock/subsys/atalk || RETVAL=1
218 echo "Usage: atalk {start|stop|restart|status}"