3 # description: This package is an implementation of "AFP over TCP"
4 # and provides printer, file sharing, and routing
5 # services via legacy AppleTalk networking protocol.
8 # If you use AppleTalk, 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 # read in netatalk configuration
23 if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
24 . ${ATALK_CONF_DIR}/netatalk.conf
27 # initialize return values
34 # startup code for everything
36 # Check that networking is up.
37 if [ ${NETWORKING} = "no" ]; then
38 echo "[Network isn't started]";
42 if [ ! -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
43 echo "[${ATALK_CONF_DIR}/netatalk.conf not found]";
47 if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then
48 # Quickly probe for appletalk and warn if we can't find it
49 #/sbin/modprobe appletalk || echo "[could not load appletalk module]"
50 # Check for IP Encapsulation support
51 #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]"
52 echo -n " Starting atalkd:"
53 daemon ${ATALK_SBIN}/atalkd
57 if [ -x ${ATALK_BIN}/nbprgstr ]; then
58 action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
59 action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
62 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
63 echo -n " Starting papd:"
64 daemon ${ATALK_SBIN}/papd
69 # check for timelord in bin directory
70 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
71 echo -n " Starting timelord"
72 daemon ${ATALK_BIN}/timelord
76 # check for timelord in sbin directory
77 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
78 echo -n " Starting timelord"
79 daemon ${ATALK_SBIN}/timelord
83 # check for a2boot in bin directory
84 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
85 echo -n " Starting a2boot"
86 daemon ${ATALK_BIN}/a2boot
90 # check for a2boot in sbin directory
91 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
92 echo -n " Starting a2boot"
93 daemon ${ATALK_SBIN}/a2boot
99 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ] ; then
100 echo -n " Starting cnid_metad:"
101 daemon ${ATALK_SBIN}/cnid_metad $CNID_CONFIG
106 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
107 echo -n " Starting afpd:"
108 daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
109 -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
114 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
116 touch /var/lock/subsys/atalk || RETVAL=1
122 echo -n 'Starting Netatalk services: '
123 if [ x"${ATALK_BGROUND}" = x"yes" ]; then
124 echo -n "(backgrounded)"
125 atalk_startup >& /dev/null &
133 echo 'Shutting down Netatalk services: '
134 if [ x"${ATALKD_RUN}" != x"no" ]; then
135 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
136 echo -n " Stopping papd:"
142 # checking for timelord in bin directory
143 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
144 echo -n " Stopping timelord:"
149 # checking for timelord in sbin directory
150 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
151 echo -n " Stopping timelord:"
156 # checking for a2boot in bin directory
157 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
158 echo -n " Stopping a2boot:"
163 # checking for a2boot in sbin directory
164 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
165 echo -n " Stopping a2boot:"
170 action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
171 action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
173 # kill atalkd last, since without it the plumbing goes away.
174 if [ -x ${ATALK_SBIN}/atalkd ]; then
175 echo -n " Stopping atalk:"
182 # kill this separately as we also do AFP/tcp
183 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
184 echo -n " Stopping afpd:"
190 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
191 echo -n " Stopping cnid_metad:"
197 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
199 rm -f /var/lock/subsys/atalk || RETVAL=1
218 echo "Usage: $0 {start|stop|restart|reload|status}"