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.
7 # Netatalk :NETATALK_VERSION: daemons.
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
23 ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1`
24 ATALK_UNIX_CHARSET='LOCALE'
25 ATALK_MAC_CHARSET='MAC_ROMAN'
30 AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
32 CNID_CONFIG="-l log_note"
41 # read in netatalk configuration
42 if [ -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
43 . ${ATALK_CONF_DIR}/netatalk.conf
46 # initialize return values
53 # startup code for everything
55 # Check that networking is up.
56 if [ ${NETWORKING} = "no" ]; then
57 echo "[Network isn't started]";
61 if [ ! -f ${ATALK_CONF_DIR}/netatalk.conf ]; then
62 echo "[${ATALK_CONF_DIR}/netatalk.conf not found]";
66 if [ x"${ATALKD_RUN}" != x"no" -a -x ${ATALK_SBIN}/atalkd ]; then
67 # Quickly probe for appletalk and warn if we can't find it
68 #/sbin/modprobe appletalk || echo "[could not load appletalk module]"
69 # Check for IP Encapsulation support
70 #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]"
71 echo -n " Starting atalkd:"
72 daemon ${ATALK_SBIN}/atalkd
76 if [ -x ${ATALK_BIN}/nbprgstr ]; then
77 action " Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
78 action " Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
81 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
82 echo -n " Starting papd:"
83 daemon ${ATALK_SBIN}/papd
88 # check for timelord in bin directory
89 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
90 echo -n " Starting timelord"
91 daemon ${ATALK_BIN}/timelord
95 # check for timelord in sbin directory
96 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
97 echo -n " Starting timelord"
98 daemon ${ATALK_SBIN}/timelord
102 # check for a2boot in bin directory
103 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
104 echo -n " Starting a2boot"
105 daemon ${ATALK_BIN}/a2boot
109 # check for a2boot in sbin directory
110 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
111 echo -n " Starting a2boot"
112 daemon ${ATALK_SBIN}/a2boot
118 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ] ; then
119 echo -n " Starting cnid_metad:"
120 daemon ${ATALK_SBIN}/cnid_metad $CNID_CONFIG
125 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ] ; then
126 echo -n " Starting afpd:"
127 daemon ${ATALK_SBIN}/afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
128 -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
133 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 -a $RETVAL_AFPD -eq 0 ]; then
135 touch /var/lock/subsys/atalk || RETVAL=1
141 echo -n 'Starting Netatalk services: '
142 if [ x"${ATALK_BGROUND}" = x"yes" -a x"${ATALKD_RUN}" != x"no" ]; then
143 echo -n "(backgrounded)"
144 atalk_startup >& /dev/null &
152 echo 'Shutting down Netatalk services: '
153 if [ x"${ATALKD_RUN}" != x"no" ]; then
154 if [ x"${PAPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/papd ]; then
155 echo -n " Stopping papd:"
161 # checking for timelord in bin directory
162 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_BIN}/timelord ]; then
163 echo -n " Stopping timelord:"
168 # checking for timelord in sbin directory
169 if [ x"${TIMELORD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/timelord ]; then
170 echo -n " Stopping timelord:"
175 # checking for a2boot in bin directory
176 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_BIN}/a2boot ]; then
177 echo -n " Stopping a2boot:"
182 # checking for a2boot in sbin directory
183 if [ x"${A2BOOT_RUN}" = x"yes" -a -x ${ATALK_SBIN}/a2boot ]; then
184 echo -n " Stopping a2boot:"
189 action " Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
190 action " Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${ATALK_BIN}/nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"
192 # kill atalkd last, since without it the plumbing goes away.
193 if [ -x ${ATALK_SBIN}/atalkd ]; then
194 echo -n " Stopping atalk:"
201 # kill this separately as we also do AFP/tcp
202 if [ x"${AFPD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/afpd ]; then
203 echo -n " Stopping afpd:"
209 if [ x"${CNID_METAD_RUN}" = x"yes" -a -x ${ATALK_SBIN}/cnid_metad ]; then
210 echo -n " Stopping cnid_metad:"
216 if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 ] ; then
218 rm -f /var/lock/subsys/atalk || RETVAL=1
237 echo "Usage: $0 {start|stop|restart|reload|status}"