diff options
author | Jakub Bogusz | 2015-01-17 19:33:22 (GMT) |
---|---|---|
committer | Jakub Bogusz | 2015-01-17 19:33:22 (GMT) |
commit | 8a32d7272d965bfc0f2d9c0362b50bdc8c264cf5 (patch) | |
tree | b43e890291beadce3a63896f72824fea970abf86 /netatalk.init | |
parent | ff7641db06f4037196811920998a39886ab0ce55 (diff) | |
download | netatalk-8a32d7272d965bfc0f2d9c0362b50bdc8c264cf5.zip netatalk-8a32d7272d965bfc0f2d9c0362b50bdc8c264cf5.tar.gz |
- rewritten SysV script and descriptions for netatalk 3:
legacy AppleTalk protocol is no longer supported, now AFP is
Diffstat (limited to 'netatalk.init')
-rw-r--r-- | netatalk.init | 136 |
1 files changed, 48 insertions, 88 deletions
diff --git a/netatalk.init b/netatalk.init index 4fd4578..b5eef58 100644 --- a/netatalk.init +++ b/netatalk.init @@ -1,13 +1,13 @@ -#! /bin/sh +#!/bin/sh +# +# netatalk Netatalk AFP server service controller daemon +# # chkconfig: 345 91 35 -# description: This package enables Linux to talk to Macintosh \ -# computers via the AppleTalk networking protocol and \ -# provides printer, file sharing, and AppleTalk routing \ -# services. # -# AppleTalk daemons. Make sure not to start atalkd in the background: -# its data structures must have time to stablize before running the -# other processes. +# description: netatalk is the service controller daemon \ +# responsible for starting and restarting the AFP daemon \ +# afpd and the CNID daemon cnid_metad. +# # Source function library. . /etc/rc.d/init.d/functions @@ -15,12 +15,6 @@ # Source networking configuration. . /etc/sysconfig/network -# Quickly probe for appletalk and warn if we can't find it -/sbin/modprobe appletalk || echo "[could not load appletalk module]" - -# Check for IP Encapsulation support -#/sbin/modprobe ipddp || echo "[could not load IP encapsulation]" - # read in netatalk configuration . /etc/sysconfig/netatalk @@ -28,7 +22,7 @@ if is_yes "${NETWORKING}"; then if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then # nls "ERROR: Networking is down. %s can't be run." <service> - msg_network_down "AppleTalk" + msg_network_down "netatalk" exit 1 fi else @@ -37,111 +31,77 @@ fi # initialize return values RETVAL=1 -RETVAL_ATALKD=0 -RETVAL_PAPD=0 -RETVAL_AFPD=0 start() { - if [ -f /var/lock/subsys/atalk ]; then - msg_already_running "AppleTalk" + if [ -f /var/lock/subsys/netatalk ]; then + msg_already_running "netatalk" exit 0 fi - if is_yes "${ATALKD_RUN}"; then - msg_starting "atalkd" - daemon atalkd - RETVAL_ATALKD=$? - run_cmd -a "$(nls "Registering %s" "${ATALK_NAME}:Workstation${ATALK_ZONE}:")" "nbprgstr -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"" - run_cmd -a "$(nls "Registering %s" "${ATALK_NAME}:netatalk${ATALK_ZONE}:")" "nbprgstr -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"" - if is_yes "${PAPD_RUN}"; then - msg_starting "papd" - daemon papd - RETVAL_PAPD=$? - fi - fi - - if is_yes "${TIMELORD_RUN}"; then - msg_starting "timelord" - daemon timelord - fi - - if is_yes "${AFPD_RUN}"; then - msg_starting "afpd" - daemon afpd ${AFPD_UAMLIST} -g ${AFPD_GUEST} -c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\" - RETVAL_AFPD=$? - fi - - if [ "$RETVAL_ATALKD" -eq 0 -a "$RETVAL_PAPD" -eq 0 -a "$RETVAL_AFPD" -eq 0 ]; then - RETVAL=0 - touch /var/lock/subsys/atalk || RETVAL=1 - fi + msg_starting "atalkd" + daemon /usr/sbin/netatalk + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/netatalk } stop() { - if [ ! -f /var/lock/subsys/atalk ]; then - msg_not_running "AppleTalk" + if [ ! -f /var/lock/subsys/netatalk ]; then + msg_not_running "netatalk" exit 0 fi - if is_yes "${ATALKD_RUN}"; then - if is_yes "${PAPD_RUN}"; then - msg_stopping "papd" - killproc papd - fi + msg_stopping "netatalk" + killproc netatalk + rm -f /var/lock/subsys/netatalk +} - if is_yes "${TIMELORD_RUN}"; then - msg_stopping "timelord" - killproc timelord - fi +reload() { + if [ ! -f /var/lock/subsys/netatalk ]; then + msg_not_running "netatalk" + RETVAL=7 + return + fi - run_cmd "$(nls "Unregistering %s" "${ATALK_NAME}:Workstation${ATALK_ZONE}:")" "nbpunrgstr \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"" - run_cmd "$(nls "Unregistering %s" "${ATALK_NAME}:netatalk${ATALK_ZONE}:")" "nbpunrgstr \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"" + msg_reloading "netatalk" + killproc netatalk -HUP + RETVAL=$? +} - msg_stopping "atalk" - killproc atalkd +condrestart() { + if [ ! -f /var/lock/subsys/netatalk ]; then + msg_not_running "netatalk" + RETVAL=$1 + return fi - if is_yes "${AFPD_RUN}"; then - msg_stopping "afpd" - killproc afpd - fi - rm -f /var/lock/subsys/atalk >/dev/null 2>&1 + stop + start } RETVAL=0 -# startup code for everything case "$1" in start) start ;; - stop) stop ;; - restart|force-reload) + restart) stop start ;; + try-restart) + condrestart 0 + ;; + reload|force-reload) + reload + ;; status) - if is_yes "${ATALKD_RUN}"; then - if is_yes "${PAPD_RUN}"; then - status papd - fi - - if is_yes "${TIMELORD_RUN}"; then - status timelord - fi - - if is_yes "${AFPD_RUN}"; then - status afpd - fi - status atalkd - nbplkup ${ATALK_NAME} - fi - exit $? + status netatalk + RETVAL=$? ;; *) - msg_usage "$0 {start|stop|restart|force-reload|status}" + msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" exit 3 esac |