]> git.pld-linux.org Git - packages/netatalk.git/blob - netatalk.init
- cleaning
[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 ]; then
30                 # nls "ERROR: Networking is down. %s can't be run." <service>
31                 msg_network_down "AppleTalk"
32                 exit 1
33         fi
34 else
35         exit 0
36 fi
37
38 # initialize return values
39 RETVAL=1
40 RETVAL_ATALKD=0
41 RETVAL_PAPD=0
42 RETVAL_AFPD=0
43
44 # startup code for everything
45 case "$1" in
46   start)
47         if [ -f /var/lock/subsys/atalk ]; then
48                 msg_already_running "AppleTalk"
49                 exit 1
50         fi
51
52         if is_no "${ATALKD_RUN}"; then 
53                 msg_starting "atalkd"
54                 daemon atalkd
55                 RETVAL_ATALKD=$?
56                 run_cmd $(nls "Registering %s" "${ATALK_NAME}:Workstation${ATALK_ZONE}:") "nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\""
57                 run_cmd $(nls "Registering %s" "${ATALK_NAME}:netatalk${ATALK_ZONE}:") "nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\""
58                 if is_yes "${PAPD_RUN}"; then
59                         msg_starting "papd"
60                         daemon papd
61                         RETVAL_PAPD=$?
62                 fi
63         fi
64
65         if is_yes "${TIMELORD_RUN}"; then
66                 msg_starting "timelord"
67                 daemon timelord
68         fi
69
70         if is_yes "${AFPD_RUN}"; then
71                 msg_starting "afpd"
72                 daemon afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
73                 RETVAL_AFPD=$?
74         fi
75
76         if [ "$RETVAL_ATALKD" -eq 0 -a "$RETVAL_PAPD" -eq 0 -a "$RETVAL_AFPD" -eq 0 ]; then
77         RETVAL=0
78         touch /var/lock/subsys/atalk || RETVAL=1
79         fi
80         ;;
81
82   stop)
83         if [ ! -f /var/lock/subsys/atalk ]; then
84                 msg_not_running "AppleTalk"
85                 exit 1
86         fi
87
88         if is_no "${ATALKD_RUN}"; then
89                 if is_yes "${PAPD_RUN}"; then
90                         msg_stopping "papd"
91                         killproc papd
92                         RETVAL_PAPD=$?
93                 fi
94
95                 if is_yes "${TIMELORD_RUN}"; then
96                         msg_stopping "timelord"
97                         killproc timelord
98                 fi
99
100                 run_cmd $(nls "Unregistering %s" "${ATALK_NAME}:Workstation${ATALK_ZONE}:") "nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\""
101                 run_cmd $(nls "Unregistering %s" "${ATALK_NAME}:netatalk${ATALK_ZONE}:") "nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\""
102
103                 msg_stopping "atalk"
104                 killproc atalkd
105                 RETVAL_ATALKD=$?
106         fi
107
108         if [ is_yes "${AFPD_RUN}"; then
109                 msg_stopping "afpd"
110                 killproc afpd
111                 RETVAL_AFPD=$?
112         fi
113
114         if [ "$RETVAL_ATALKD" -eq 0 -a "$RETVAL_PAPD" -eq 0 -a "$RETVAL_AFPD" -eq 0 ]; then
115                 RETVAL=0
116                 rm -f /var/lock/subsys/atalk || RETVAL=1
117         fi
118         ;;
119   restart|reload)
120         $0 stop
121         $0 start
122         RETVAL=$?
123         ;;
124   status)
125         status atalkd
126         RETVAL=$?
127         ;;
128   *)
129         msg_usage "$0 {start|stop|restart|reload|status}"
130         exit 1
131 esac
132
133 exit $RETVAL
This page took 0.033814 seconds and 4 git commands to generate.