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 if [ "x$CNID_DBD_LOGCONFIG" = "x" ]; then
105 daemon ${ATALK_SBIN}/cnid_metad
107 daemon ${ATALK_SBIN}/cnid_metad -l "$CNID_DBD_LOGCONFIG"
113 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
114 echo -n " Starting afpd:"
115 daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
116 -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
121 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
123 touch /var/lock/subsys/atalk || RETVAL=1
129 echo -n 'Starting AppleTalk services: '
130 if [ x"${ATALK_BGROUND}" = x"yes" ]; then
131 echo -n "(backgrounded)"
132 atalk_startup >& /dev/null &
140 echo 'Shutting down AppleTalk services: '
141 if [ x"${ATALKD_RUN}" != x"no" ]; then
142 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
143 echo -n " Stopping papd:"
149 # checking for timelord in bin directory
150 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
151 echo -n " Stopping timelord:"
156 # checking for timelord in sbin directory
157 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
158 echo -n " Stopping timelord:"
163 # checking for a2boot in bin directory
164 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
165 echo -n " Stopping a2boot:"
170 # checking for a2boot in sbin directory
171 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
172 echo -n " Stopping a2boot:"
177 action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
178 action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
180 # kill atalkd last, since without it the plumbing goes away.
181 if [ -x ${ATALK_SBIN}/atalkd ]; then
182 echo -n " Stopping atalk:"
189 # kill this separately as we also do AFP/tcp
190 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
191 echo -n " Stopping afpd:"
197 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
198 echo -n " Stopping cnid_metad:"
204 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
206 rm -f /var/lock/subsys/atalk || RETVAL=1
220 echo "Usage: atalk {start|stop|restart|status}"