]> git.pld-linux.org Git - packages/netatalk.git/blob - netatalk.init
- killed trailing spaces/tabs
[packages/netatalk.git] / netatalk.init
1 #! /bin/sh
2 # chkconfig:    345 91 35
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 \
6 #               services.
7 #
8 # AppleTalk daemons. Make sure not to start atalkd in the background:
9 # its data structures must have time to stablize before running the
10 # other processes.
11
12 # Source function library.
13 . /etc/rc.d/init.d/functions
14
15 # Source networking configuration.
16 . /etc/sysconfig/network
17
18 # Quickly probe for appletalk and warn if we can't find it
19 /sbin/modprobe appletalk || echo "[could not load appletalk module]"
20
21 # Check for IP Encapsulation support
22 #/sbin/modprobe ipddp || echo "[could not load IP encapsulation]"
23
24 # read in netatalk configuration
25 . /etc/sysconfig/netatalk
26
27 # Check that networking is up.
28 if is_yes "${NETWORKING}"; then
29         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
30                 msg_network_down "AppleTalk"
31                 exit 1
32         fi
33 else
34         exit 0
35 fi
36
37 # initialize return values
38 RETVAL=1
39 RETVAL_ATALKD=0
40 RETVAL_PAPD=0
41 RETVAL_AFPD=0
42
43 # startup code for everything
44 case "$1" in
45   start)
46         if [ -f /var/lock/subsys/atalk ]; then
47                 msg_already_running "AppleTalk"
48                 exit 0
49         fi
50
51         if is_yes "${ATALKD_RUN}"; then
52                 msg_starting "atalkd"
53                 daemon atalkd
54                 RETVAL_ATALKD=$?
55                 run_cmd -a "$(nls "Registering %s" "${ATALK_NAME}:Workstation${ATALK_ZONE}:")" "nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\""
56                 run_cmd -a "$(nls "Registering %s" "${ATALK_NAME}:netatalk${ATALK_ZONE}:")" "nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\""
57                 if is_yes "${PAPD_RUN}"; then
58                         msg_starting "papd"
59                         daemon papd
60                         RETVAL_PAPD=$?
61                 fi
62         fi
63
64         if is_yes "${TIMELORD_RUN}"; then
65                 msg_starting "timelord"
66                 daemon timelord
67         fi
68
69         if is_yes "${AFPD_RUN}"; then
70                 msg_starting "afpd"
71                 daemon afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
72                 RETVAL_AFPD=$?
73         fi
74
75         if [ "$RETVAL_ATALKD" -eq 0 -a "$RETVAL_PAPD" -eq 0 -a "$RETVAL_AFPD" -eq 0 ]; then
76                 RETVAL=0
77                 touch /var/lock/subsys/atalk || RETVAL=1
78         fi
79         ;;
80
81   stop)
82         if [ ! -f /var/lock/subsys/atalk ]; then
83                 msg_not_running "AppleTalk"
84                 exit 0
85         fi
86
87         if is_yes "${ATALKD_RUN}"; then
88                 if is_yes "${PAPD_RUN}"; then
89                         msg_stopping "papd"
90                         killproc papd
91                 fi
92
93                 if is_yes "${TIMELORD_RUN}"; then
94                         msg_stopping "timelord"
95                         killproc timelord
96                 fi
97
98                 run_cmd "$(nls "Unregistering %s" "${ATALK_NAME}:Workstation${ATALK_ZONE}:")" "nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\""
99                 run_cmd "$(nls "Unregistering %s" "${ATALK_NAME}:netatalk${ATALK_ZONE}:")" "nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\""
100
101                 msg_stopping "atalk"
102                 killproc atalkd
103         fi
104
105         if  is_yes "${AFPD_RUN}"; then
106                 msg_stopping "afpd"
107                 killproc afpd
108         fi
109
110         RETVAL=0
111         rm -f /var/lock/subsys/atalk >/dev/null 2>&1
112         ;;
113   restart|force-reload)
114         $0 stop
115         $0 start
116         exit $?
117         ;;
118   status)
119         if is_yes "${ATALKD_RUN}"; then
120             if is_yes "${PAPD_RUN}"; then
121                 status papd
122             fi
123
124             if is_yes "${TIMELORD_RUN}"; then
125                 status timelord
126             fi
127
128             if  is_yes "${AFPD_RUN}"; then
129                 status afpd
130             fi
131             status atalkd
132             nbplkup ${ATALK_NAME}
133         fi
134         exit $?
135         ;;
136   *)
137         msg_usage "$0 {start|stop|restart|force-reload|status}"
138         exit 3
139 esac
140
141 exit $RETVAL
This page took 0.109979 seconds and 4 git commands to generate.