4 # Required-Start: $remote_fs $syslog
5 # Should-Start: avahi-daemon
6 # Required-Stop: $remote_fs $syslog
7 # Default-Start: 2 3 4 5
11 # netatalk Netatalk :NETATALK_VERSION: initscript
12 # Author: Thomas Kaiser <Thomas.Kaiser@phg-online.de>
16 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
19 SCRIPTNAME=/etc/init.d/$NAME
21 # Guard to prevent execution if netatalk was removed.
22 test -x :SBINDIR:/afpd || exit 0
24 # Set defaults. Please change these options in /etc/default/netatalk
25 ATALK_NAME=`/bin/hostname --short`
26 ATALK_UNIX_CHARSET='LOCALE'
27 ATALK_MAC_CHARSET='MAC_ROMAN'
32 AFPD_UAMLIST="-U uams_dhx2.so"
34 CNID_CONFIG="-l log_note"
43 # old /etc/default/netatalk expected hostname in $HOSTNAME by default
44 HOSTNAME=`/bin/hostname`
46 # Read in netatalk configuration.
47 if [ -f /etc/default/netatalk ]; then
48 . /etc/default/netatalk
51 # Start Netatalk servers.
53 if [ x"$ATALKD_RUN" = x"yes" ]; then
55 # Try to load the AppleTalk kernel module if it was intended.
56 if grep -q '^appletalk$' /etc/modules; then
57 /sbin/modprobe appletalk || echo "[could not load appletalk module]"
60 # Start atalkd server.
63 # register workstation
64 :BINDIR:/nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE"
65 :BINDIR:/nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE"
70 # prepare startup of file services
71 if [ "x$CNID_METAD_RUN" = "xyes" -a -x :SBINDIR:/cnid_metad ] ; then
73 :SBINDIR:/cnid_metad $CNID_CONFIG
76 if [ x"$AFPD_RUN" = x"yes" ]; then
77 :SBINDIR:/afpd $AFPD_UAMLIST -g $AFPD_GUEST -c $AFPD_MAX_CLIENTS \
78 -n "$ATALK_NAME$ATALK_ZONE"
82 if [ "x$ATALKD_RUN" = "xyes" ]; then
83 if [ "x$PAPD_RUN" = "xyes" ]; then
88 if [ x"$TIMELORD_RUN" = x"yes" ]; then
97 if [ "x$ATALK_BGROUND" = "xyes" -a "x$ATALKD_RUN" = "xyes" ]; then
98 echo "Starting Netatalk services in the background."
99 atalk_startup >/dev/null &
101 echo -n "Starting Netatalk services (this will take a while): "
108 echo -n "Stopping Netatalk Daemons:"
110 start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/afpd
112 echo -n " cnid_metad"
113 start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/cnid_metad
115 if test -x :SBINDIR:/papd; then
117 start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/papd
120 if test -x :SBINDIR:/timelord; then
122 start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/timelord
125 if test -x :SBINDIR:/atalkd; then
127 start-stop-daemon --stop --quiet --oknodo --exec :SBINDIR:/atalkd
138 echo -n "Restarting Netatalk Daemons (this will take a while)"
149 echo "Usage: $0 {start|stop|restart|force-reload}" >&2