wok-6.x rev 7285
nfs-utils: add /etc/init.d/nfsd
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Nov 16 10:46:29 2010 +0100 (2010-11-16) |
parents | 1fbd398aaaf4 |
children | 9cebb5153a07 |
files | nfs-utils/receipt nfs-utils/stuff/etc/exports nfs-utils/stuff/etc/init.d/nfsd |
line diff
1.1 --- a/nfs-utils/receipt Tue Nov 16 03:59:56 2010 +0000 1.2 +++ b/nfs-utils/receipt Tue Nov 16 10:46:29 2010 +0100 1.3 @@ -8,8 +8,9 @@ 1.4 TARBALL="$PACKAGE-$VERSION.tar.bz2" 1.5 WEB_SITE="http://nfs.sourceforge.net/" 1.6 WGET_URL="$SF_MIRROR/nfs/$PACKAGE/$VERSION/$TARBALL" 1.7 -DEPENDS="libtirpc libwrap util-linux-ng-blkid util-linux-ng-uuid" 1.8 +DEPENDS="libtirpc libwrap util-linux-ng-blkid util-linux-ng-uuid rpcbind" 1.9 BUILD_DEPENDS="libtirpc-dev util-linux-ng-blkid-dev libcap-dev" 1.10 +CONFIG_FILES="/etc/exports" 1.11 TAGS="filesystem" 1.12 1.13 # Rules to configure and make the package. 1.14 @@ -28,7 +29,17 @@ 1.15 genpkg_rules() 1.16 { 1.17 mkdir -p $fs/usr 1.18 + cp -a stuff/* $fs 1.19 cp -a $_pkg/var $fs 1.20 cp -a $_pkg/sbin $fs 1.21 cp -a $_pkg/usr/sbin $fs/usr 1.22 } 1.23 + 1.24 +post_install() 1.25 +{ 1.26 + grep ^nfs $1/etc/services || 1.27 + sed -i 's|.* 2401/tcp.*|nfs 2049/tcp\nnfs 2049/udp\n&|' $1/etc/services 1.28 + [ -s $1/etc/exports ] || cat > $1/etc/exports <<EOT 1.29 +#/home 192.168.0.0/255.255.255.0(rw,subtree_check) 1.30 +EOT 1.31 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/nfs-utils/stuff/etc/init.d/nfsd Tue Nov 16 10:46:29 2010 +0100 2.3 @@ -0,0 +1,84 @@ 2.4 +#!/bin/sh 2.5 +# /etc/init.d/nfsd: Start, stop and restart NFS deamon on SliTaz, at boot 2.6 +# time or with the command line. 2.7 +# 2.8 +# To start daemon at boot time, just put the right name in the $RUN_DAEMONS 2.9 +# variable of /etc/rcS.conf. 2.10 +# 2.11 +. /etc/init.d/rc.functions 2.12 + 2.13 +NAME=NFSd 2.14 +DESC="NFS Daemon" 2.15 +DAEMON=/usr/sbin/rpc.nfsd 2.16 +PID_FILE=/var/run/nfsd.pid 2.17 +OPTION="8" 2.18 +[ -n "$NFSD_OPTION" ] || OPTION="$NFSD_OPTION" 2.19 + 2.20 +stop_warning() 2.21 +{ 2.22 +echo "Warning: filesystems are unexported but nfsd and lockd processes are still alive..." 2.23 +} 2.24 + 2.25 +case "$1" in 2.26 + start) 2.27 + if active_pidfile $PID_FILE nfsd ; then 2.28 + echo "$NAME already running." 2.29 + exit 1 2.30 + fi 2.31 + echo -n "Starting $DESC: $NAME... " 2.32 + portmap="$(pidof portmap)" 2.33 + if [ -n "$portmap" ]; then 2.34 + kill $portmap 2.35 + sleep 2 2.36 + fi 2.37 + [ -n "$(pidof rpcbind)" ] || rpcbind 2.38 + modprobe nfsd 2.39 + mount -t nfsd nfsd /proc/fs/nfsd 2> /dev/null 2.40 + /usr/sbin/exportfs -r 2.41 + $DAEMON $OPTION 2.42 + pidof nfsd | awk '{print $1}' > $PID_FILE 2.43 + /usr/sbin/rpc.mountd 2.44 + status 2.45 + ;; 2.46 + stop) 2.47 + if ! active_pidfile $PID_FILE nfsd ; then 2.48 + echo "$NAME is not running." 2.49 + exit 1 2.50 + fi 2.51 + echo -n "Stopping $DESC: $NAME... " 2.52 + killall rpc.mountd 2.53 + killall nfsd 2.54 + killall lockd 2.55 + /usr/sbin/exportfs -au 2.56 + /usr/sbin/exportfs -f 2.57 + stop_warning # FIXME 2.58 + rm $PID_FILE 2.59 + status 2.60 + ;; 2.61 + restart) 2.62 + if ! active_pidfile $PID_FILE nfsd ; then 2.63 + echo "$NAME is not running." 2.64 + exit 1 2.65 + fi 2.66 + echo -n "Restarting $DESC: $NAME... " 2.67 + killall rpc.mountd 2.68 + killall nfsd 2.69 + killall lockd 2.70 + /usr/sbin/exportfs -au 2.71 + /usr/sbin/exportfs -f 2.72 + sleep 2 2.73 + /usr/sbin/exportfs -r 2.74 + $DAEMON $OPTION 2.75 + pidof nfsd | awk '{print $1}' > $PID_FILE 2.76 + /usr/sbin/rpc.mountd 2.77 + status 2.78 + ;; 2.79 + *) 2.80 + echo "" 2.81 + echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]" 2.82 + echo "" 2.83 + exit 1 2.84 + ;; 2.85 +esac 2.86 + 2.87 +exit 0