• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/ap/gpl/timemachine/netatalk-2.2.0/distrib/initscripts/
1#!/sbin/runscript
2
3# Netatalk daemons.
4# If you use AppleTalk, Make sure not to start atalkd in the background:
5# its data structures must have time to stablize before running the
6# other processes.
7
8ATALK_NAME=`echo ${HOSTNAME}|cut -d. -f1`
9ATALK_UNIX_CHARSET='LOCALE'
10ATALK_MAC_CHARSET='MAC_ROMAN'
11
12CNID_METAD_RUN=yes
13AFPD_RUN=yes
14AFPD_MAX_CLIENTS=20
15AFPD_UAMLIST="-U uams_dhx.so,uams_dhx2.so"
16AFPD_GUEST=nobody
17CNID_CONFIG="-l log_note"
18
19ATALKD_RUN=no
20PAPD_RUN=no
21TIMELORD_RUN=no
22#A2BOOT_RUN=no
23ATALK_ZONE=
24ATALK_BGROUND=no
25
26depend() {
27	need net
28	use logger dns
29}
30
31atalk_startup () {
32#	. :ETCDIR:/netatalk.conf
33
34	if [ "${ATALKD_RUN}" != "no" ]; then
35		ebegin "Starting atalkd"
36		start-stop-daemon --start --quiet --exec :SBINDIR:/atalkd
37		eend $?
38
39		for reg in \
40			"${ATALK_NAME}:Workstation${ATALK_ZONE}" \
41			"${ATALK_NAME}:netatalk${ATALK_ZONE}"
42		do
43			ebegin "  Registering $reg"
44			:BINDIR:/nbprgstr "$reg"
45			eend $?
46		done
47
48		if [ "${PAPD_RUN}" = "yes" ]; then
49			ebegin "  Starting papd"
50			start-stop-daemon --start --quiet --exec :SBINDIR:/papd
51			eend $?
52		fi
53
54	fi
55
56	if [ "${CNID_METAD_RUN}" = "yes" ] ; then
57        ebegin "Starting cnid_metad"
58		start-stop-daemon --start --quiet --exec :SBINDIR:/cnid_metad -- \
59			${CNID_CONFIG}
60		eend $?
61	fi
62
63
64	if [ "${AFPD_RUN}" = "yes" ]; then
65		ebegin "Starting afpd"
66		start-stop-daemon --start --quiet --exec :SBINDIR:/afpd -- \
67			${AFPD_UAMLIST} -g ${AFPD_GUEST} -c ${AFPD_MAX_CLIENTS} \
68			-n "${ATALK_NAME}${ATALK_ZONE}"
69		eend $?
70	fi
71
72	if [ "${TIMELORD_RUN}" = "yes" ]; then
73		ebegin "Starting timelord"
74		start-stop-daemon --start --quiet --exec :SBINDIR:/timelord
75		eend $?
76	fi
77}
78
79start () {
80	. :ETCDIR:/netatalk.conf
81
82        if [ x"${ATALK_BGROUND}" = x"yes" -a "${ATALKD_RUN}" != "no" ]; then
83            echo "Starting netatalk in the background ... "
84            atalk_startup >& /dev/null &
85        else
86            atalk_startup
87        fi
88}
89
90stop () {
91	. :ETCDIR:/netatalk.conf
92
93	if [ "${AFPD_RUN}" = "yes" ]; then
94		ebegin "Stopping afpd"
95		start-stop-daemon --stop --quiet --exec :SBINDIR:/afpd
96		eend $?
97	fi
98
99	if [ "${TIMELORD_RUN}" = "yes" ]; then
100		ebegin "Stopping timelord"
101		start-stop-daemon --stop --quiet --exec :SBINDIR:/timelord
102		eend $?
103	fi
104
105	if [ "${ATALKD_RUN}" != "no" ]; then
106		if [ "${PAPD_RUN}" = "yes" ]; then
107			ebegin "Stopping papd"
108			start-stop-daemon --stop --quiet --exec :SBINDIR:/papd
109			eend $?
110		fi
111
112		for reg in \
113			"${ATALK_NAME}:Workstation${ATALK_ZONE}" \
114			"${ATALK_NAME}:netatalk${ATALK_ZONE}"
115		do
116			ebegin "Unregistering $reg"
117			:BINDIR:/nbpunrgstr "$reg"
118			eend $?
119		done
120
121		ebegin "Stopping atalkd"
122		start-stop-daemon --stop --quiet --exec :SBINDIR:/atalkd
123		eend $?
124	fi
125
126	if [ "${CNID_METAD_RUN}" = "yes" ] ; then
127        	ebegin "Stopping cnid_metad"
128		start-stop-daemon --stop --quiet --exec :SBINDIR:/cnid_metad
129		eend $?
130	fi
131}
132