wok-6.x rev 13274
netatalk: add init script
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Aug 22 22:52:48 2012 +0200 (2012-08-22) |
parents | 9bde3249a31f |
children | a4ff6ffd215b |
files | netatalk/receipt netatalk/stuff/etc/init.d/netatalk |
line diff
1.1 --- a/netatalk/receipt Wed Aug 22 18:30:27 2012 +0200 1.2 +++ b/netatalk/receipt Wed Aug 22 22:52:48 2012 +0200 1.3 @@ -34,6 +34,7 @@ 1.4 cp -a $install/usr/sbin $fs/usr 1.5 cp -a $install/usr/lib/netatalk $fs/usr/lib 1.6 cp -a $install/etc $fs 1.7 + cp -a $stuff/etc $fs 1.8 rm -f $fs/etc/netatalk/uams/*a 1.9 } 1.10
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/netatalk/stuff/etc/init.d/netatalk Wed Aug 22 22:52:48 2012 +0200 2.3 @@ -0,0 +1,81 @@ 2.4 +#!/bin/sh 2.5 +# Start, stop and restart the netatalk deamons on SliTaz, at boot time or 2.6 +# with the command line. 2.7 +# 2.8 +# To start netatalk at boot time, just put the right name in the $RUN_DAEMONS 2.9 +# variable of /etc/rcS.conf and configure options with /etc/daemons.conf. 2.10 +# 2.11 +. /etc/init.d/rc.functions 2.12 + 2.13 +NAME=atalkd 2.14 +DESC="netatalk deamons" 2.15 +PIDFILE=/var/run/$NAME.pid 2.16 +AFPD_UAMLIST="-U uams_dhx.so,uams_clrtxt.so,uams_randnum.so" 2.17 +AFPD_GUEST=nobody 2.18 +AFPD_MAX_CLIENTS=50 2.19 +ATALK_ZONE= 2.20 +ATALK_NAME=$(hostname -s) 2.21 +ATALK_BGROUND=no 2.22 + 2.23 +. /etc/netatalk/netatalk.conf 2.24 + 2.25 +# Start Netatalk servers. 2.26 +atalk_startup() 2.27 +{ 2.28 + if [ "$ATALKD_RUN" = "yes" ]; then 2.29 + modprobe appletalk 2.30 + atalkd 2.31 + pidof atalkd > $PIDFILE 2.32 + 2.33 + # register workstation 2.34 + nbprgstr -p 4 "$ATALK_NAME:Workstation$ATALK_ZONE" 2.35 + nbprgstr -p 4 "$ATALK_NAME:netatalk$ATALK_ZONE" 2.36 + 2.37 + [ "$PAPD_RUN" = "yes" ] && papd 2.38 + [ "$TIMELORD_RUN" = "yes" ] && timelord 2.39 + fi 2.40 + 2.41 + [ "$AFPD_RUN" = "yes" ] && afpd $AFPD_UAMLIST -g $AFPD_GUEST \ 2.42 + -c $AFPD_MAX_CLIENTS -n "$ATALK_NAME$ATALK_ZONE" 2.43 +} 2.44 + 2.45 +case "$1" in 2.46 +start) 2.47 + if active_pidfile $PIDFILE $NAME ; then 2.48 + echo "$NAME is already running." 2.49 + exit 1 2.50 + fi 2.51 + echo -n "Starting $DESC: $NAME... " 2.52 + if [ "$ATALK_BGROUND" == "yes" ]; then 2.53 + atalk_startup >/dev/null & 2.54 + else 2.55 + atalk_startup 2.56 + fi 2.57 + status 2.58 + ;; 2.59 +stop) 2.60 + if ! active_pidfile $PIDFILE $NAME ; then 2.61 + echo "$NAME is not running." 2.62 + exit 1 2.63 + fi 2.64 + echo -n "Stopping $DESC: $NAME... " 2.65 + killall afpd 2.66 + killall papd 2.67 + killall timelord 2.68 + killall atalkd 2.69 + status 2.70 + ;; 2.71 +restart) 2.72 + $0 start 2.73 + sleep 2 2.74 + $0 stop 2.75 + ;; 2.76 +*) 2.77 + echo "" 2.78 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 2.79 + echo "" 2.80 + exit 1 2.81 + ;; 2.82 +esac 2.83 + 2.84 +exit 0