wok annotate netatalk-pam/stuff/etc/init.d/netatalk @ rev 20892
Remove ashism ==
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Feb 26 09:14:07 2019 +0100 (2019-02-26) |
parents | ff5fd8788cd9 |
children |
rev | line source |
---|---|
pascal@13275 | 1 #!/bin/sh |
al@19161 | 2 # Start, stop and restart the netatalk daemons on SliTaz, at boot time or |
pascal@13275 | 3 # with the command line. |
pascal@13275 | 4 # |
pascal@13275 | 5 # To start netatalk at boot time, just put the right name in the $RUN_DAEMONS |
pascal@13275 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf. |
pascal@13275 | 7 # |
pascal@13275 | 8 . /etc/init.d/rc.functions |
pascal@13275 | 9 |
pascal@13275 | 10 NAME=atalkd |
al@19159 | 11 DESC="$(_ 'Netatalk daemons')" |
pascal@13275 | 12 PIDFILE=/var/run/$NAME.pid |
pascal@13275 | 13 AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so" |
pascal@13275 | 14 AFPD_GUEST=nobody |
pascal@13275 | 15 AFPD_MAX_CLIENTS=50 |
pascal@13275 | 16 ATALK_ZONE= |
pascal@13275 | 17 ATALK_NAME=$(hostname -s) |
pascal@13275 | 18 ATALK_BGROUND=no |
pascal@13275 | 19 |
pascal@13275 | 20 . /etc/netatalk/netatalk.conf |
pascal@13275 | 21 |
pascal@13275 | 22 # Start Netatalk servers. |
pascal@13275 | 23 atalk_startup() |
pascal@13275 | 24 { |
pascal@20892 | 25 if [ "$ATALKD_RUN" = "yes" ]; then |
pascal@13275 | 26 modprobe appletalk |
pascal@13275 | 27 atalkd |
pascal@13275 | 28 pidof atalkd > $PIDFILE |
pascal@13275 | 29 |
pascal@13275 | 30 # register workstation |
pascal@13275 | 31 nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE" |
pascal@13275 | 32 nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE" |
pascal@13275 | 33 |
pascal@20892 | 34 [ "$PAPD_RUN" = "yes" ] && papd |
pascal@20892 | 35 [ "$TIMELORD_RUN" = "yes" ] && timelord |
pascal@13275 | 36 fi |
pascal@13275 | 37 |
pascal@20892 | 38 [ "$AFPD_RUN" = "yes" ] && afpd $AFPD_UAMLIST -g $AFPD_GUEST \ |
pascal@13275 | 39 -c $AFPD_MAX_CLIENTS -n "$ATALK_NAME$ATALK_ZONE" |
pascal@13275 | 40 } |
pascal@13275 | 41 |
pascal@13275 | 42 case "$1" in |
al@19159 | 43 start) |
al@19159 | 44 if active_pidfile $PIDFILE $NAME ; then |
al@19159 | 45 _ '%s is already running.' $NAME |
al@19159 | 46 exit 1 |
al@19159 | 47 fi |
al@19159 | 48 action 'Starting %s: %s...' "$DESC" $NAME |
pascal@20892 | 49 if [ "$ATALK_BGROUND" = "yes" ]; then |
al@19159 | 50 atalk_startup >/dev/null & |
al@19159 | 51 else |
al@19159 | 52 atalk_startup |
al@19159 | 53 fi |
al@19159 | 54 status |
al@19159 | 55 ;; |
al@19159 | 56 stop) |
al@19159 | 57 if ! active_pidfile $PIDFILE $NAME ; then |
al@19159 | 58 _ '%s is not running.' $NAME |
al@19159 | 59 exit 1 |
al@19159 | 60 fi |
al@19159 | 61 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 62 killall afpd |
al@19159 | 63 killall papd |
al@19159 | 64 killall timelord |
al@19159 | 65 killall atalkd |
al@19159 | 66 status |
al@19159 | 67 ;; |
al@19159 | 68 restart) |
al@19159 | 69 $0 start |
al@19159 | 70 sleep 2 |
al@19159 | 71 $0 stop |
al@19159 | 72 ;; |
al@19159 | 73 *) |
al@19159 | 74 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 75 newline |
pascal@13275 | 76 exit 1 |
al@19159 | 77 ;; |
pascal@13275 | 78 esac |
pascal@13275 | 79 |
pascal@13275 | 80 exit 0 |