ports/opt (3.1): [notify] nfs-utils: improved rc scripts
![](https://secure.gravatar.com/avatar/df8330968b6df8cd1c1942c5fb4b720c.jpg?s=120&d=mm&r=g)
commit d64d591e8b7605c507ac74391702803168fac55b Author: Juergen Daubert <jue@jue.li> Date: Thu Mar 5 14:54:32 2015 +0100 [notify] nfs-utils: improved rc scripts release 2 of nfs-utils 1.3.2 comes with a new set of rc scripts which hopefully improves nfs handling on CRUX. The changes in detail: - seperate run-control scripts for idmapd, statd, mountd and nfsd which are called from the other scripts - idmapd and mountd are behaving more sane now, because they creates pid files in /var/run - nfs is now a rc scripts that includes stuff needed by both nfs-server and -client - the only purpose of nfsclient is to mount/unmount nfs filessystems - nfsserver starts all additional daemons that needs to be run to serve nfs filesystems Note: because of the changes above it's necessary to stop all nfs services before the update and start them again afterwards. Adjustment of /etc/rc.conf is necessary too, possible entries are 'nfs nfsclient', 'nfs nfsserver' or 'nfs nfsserver nfsclient' Please report any problems. diff --git a/nfs-utils/.footprint b/nfs-utils/.footprint index 0236123..f6e7958 100644 --- a/nfs-utils/.footprint +++ b/nfs-utils/.footprint @@ -4,7 +4,12 @@ drwxr-xr-x root/root etc/exports.d/ -rw-r--r-- root/root etc/idmapd.conf drwxr-xr-x root/root etc/rc.d/ -rwxr-xr-x root/root etc/rc.d/nfs +-rwxr-xr-x root/root etc/rc.d/nfsclient -rwxr-xr-x root/root etc/rc.d/nfsserver +-rwxr-xr-x root/root etc/rc.d/rpc.idmapd +-rwxr-xr-x root/root etc/rc.d/rpc.mountd +-rwxr-xr-x root/root etc/rc.d/rpc.nfsd +-rwxr-xr-x root/root etc/rc.d/rpc.statd drwxr-xr-x root/root sbin/ -r-s--x--x root/root sbin/mount.nfs lrwxrwxrwx root/root sbin/mount.nfs4 -> mount.nfs @@ -61,6 +66,7 @@ drwxr-xr-x root/root var/ drwxr-xr-x root/root var/lib/ drwxr-xr-x nobody/root var/lib/nfs/ -rw-r--r-- root/root var/lib/nfs/etab (EMPTY) +drwxr-xr-x root/root var/lib/nfs/nfsdcltrack/ -rw-r--r-- root/root var/lib/nfs/rmtab (EMPTY) drwxr-xr-x root/root var/lib/nfs/rpc_pipefs/ drwx------ nobody/root var/lib/nfs/sm.bak/ diff --git a/nfs-utils/.md5sum b/nfs-utils/.md5sum index 68a042e..297f6eb 100644 --- a/nfs-utils/.md5sum +++ b/nfs-utils/.md5sum @@ -1,6 +1,11 @@ c5ccf58f5f9f57aba75c8b72219eb6e6 exports 167ea3a16eb6f33b3642e920147bb265 idmapd.conf -1477840e1c19e0ac95c538db8b401d90 nfs +6d383530212eb1f70811e73282358036 nfs 1e2f3c1ed468dee02d00c534c002ea10 nfs-utils-1.3.2.tar.bz2 -071bb2c4e2104599f0bba55a8ce35f37 nfsserver +cdb5314516ef986b5283ee7dcc7d2278 nfsclient +794de0e76b5532fa68ac3ad57bd78856 nfsserver +c43297cce919319aeef70cfd25103850 rpc.idmapd +4d37ba8d95cc2acd5a9e1bd942b8e89b rpc.mountd +abde0543c54fac9353cb22015fa7a898 rpc.nfsd +9c70fa34927bd6d7723e0a36253e0a52 rpc.statd b4c745cd305c718157af2f24eef21525 statd_foreground_mode.patch diff --git a/nfs-utils/Pkgfile b/nfs-utils/Pkgfile index 2de2967..6b4b3b1 100644 --- a/nfs-utils/Pkgfile +++ b/nfs-utils/Pkgfile @@ -5,9 +5,10 @@ name=nfs-utils version=1.3.2 -release=1 -source=(http://downloads.sourceforge.net/project/nfs/$name/$version/$name-$version.t... \ - exports idmapd.conf nfs nfsserver \ +release=2 +source=(http://downloads.sourceforge.net/project/nfs/$name/$version/$name-$version.t... + exports idmapd.conf + nfs nfsclient nfsserver rpc.idmapd rpc.statd rpc.mountd rpc.nfsd statd_foreground_mode.patch) build () { @@ -23,17 +24,17 @@ build () { --with-tcp-wrappers \ --enable-libmount-mount make - install -d $PKG/sbin make DESTDIR=$PKG install - install -D -m 755 $SRC/nfs $PKG/etc/rc.d/nfs - install -D -m 755 $SRC/nfsserver $PKG/etc/rc.d/nfsserver - install -D -m 644 $SRC/exports $PKG/etc/exports - install -D -m 644 $SRC/idmapd.conf $PKG/etc/idmapd.conf + install -d $PKG/etc/rc.d - install -d $PKG/var/lib/nfs/{rpc_pipefs,v4recovery} + install -m 755 $SRC/nfs{,client,server} $PKG/etc/rc.d/ + install -m 755 $SRC/rpc.* $PKG/etc/rc.d/ + install -m 644 $SRC/{exports,idmapd.conf} $PKG/etc/ + + install -d $PKG/var/lib/nfs/{rpc_pipefs,v4recovery,nfsdcltrack} install -d $PKG/etc/exports.d - + # force rpc.statd to run as user nobody chown nobody $PKG/var/lib/nfs } diff --git a/nfs-utils/nfs b/nfs-utils/nfs index 8b720c9..a3eccfd 100644 --- a/nfs-utils/nfs +++ b/nfs-utils/nfs @@ -1,6 +1,6 @@ #!/bin/sh # -# /etc/rc.d/nfs: start/stop nfs client +# /etc/rc.d/nfs: start/stop nfs daemons needed by nfs client and server # PIPEFS=/var/lib/nfs/rpc_pipefs @@ -9,19 +9,16 @@ case $1 in start) /bin/mount -t rpc_pipefs rpc_pipefs $PIPEFS /usr/sbin/sm-notify - /usr/sbin/rpc.idmapd - /usr/sbin/rpc.statd - /bin/mount -a -t nfs + /etc/rc.d/rpc.idmapd start + /etc/rc.d/rpc.statd start ;; stop) - /bin/umount -a -t nfs,nfs4 - killall -q /usr/sbin/rpc.statd - killall -q /usr/sbin/rpc.idmapd + /etc/rc.d/rpc.statd stop + /etc/rc.d/rpc.idmapd stop /bin/umount $PIPEFS ;; restart) $0 stop - sleep 2 $0 start ;; *) diff --git a/nfs-utils/nfsclient b/nfs-utils/nfsclient new file mode 100644 index 0000000..1dc429b --- /dev/null +++ b/nfs-utils/nfsclient @@ -0,0 +1,22 @@ +#!/bin/sh +# +# /etc/rc.d/nfs: start/stop nfs client +# + +case $1 in +start) + /bin/mount -a -t nfs + ;; +stop) + /bin/umount -a -t nfs,nfs4 + ;; +restart) + $0 stop + $0 start + ;; +*) + echo "usage: $0 [start|stop|restart]" + ;; +esac + +# End of file diff --git a/nfs-utils/nfsserver b/nfs-utils/nfsserver index 18d65e6..ed02853 100644 --- a/nfs-utils/nfsserver +++ b/nfs-utils/nfsserver @@ -4,31 +4,23 @@ # NFSD=/proc/fs/nfsd -PIPEFS=/var/lib/nfs/rpc_pipefs case $1 in start) /bin/mount -t nfsd nfsd $NFSD - /bin/mount -t rpc_pipefs rpc_pipefs $PIPEFS - /usr/sbin/rpc.idmapd /usr/sbin/exportfs -a - /usr/sbin/rpc.mountd - /usr/sbin/rpc.statd --no-notify - /usr/sbin/rpc.nfsd --syslog 8 + /etc/rc.d/rpc.mountd start + /etc/rc.d/rpc.nfsd start /usr/sbin/sm-notify ;; stop) - killall -q -2 nfsd - killall -q /usr/sbin/rpc.statd - killall -q /usr/sbin/rpc.mountd + /etc/rc.d/rpc.nfsd stop + /etc/rc.d/rpc.mountd stop /usr/sbin/exportfs -au - killall -q /usr/sbin/rpc.idmapd - /bin/umount $PIPEFS /bin/umount $NFSD ;; restart) $0 stop - sleep 2 $0 start ;; *) diff --git a/nfs-utils/rpc.idmapd b/nfs-utils/rpc.idmapd new file mode 100644 index 0000000..293aa9e --- /dev/null +++ b/nfs-utils/rpc.idmapd @@ -0,0 +1,36 @@ +#!/bin/sh +# +# /etc/rc.d/rpc.idmapd: start/stop idmapd daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/rpc.idmapd +PID=/var/run/rpc.idmapd.pid +OPTS="-f" + +case $1 in +start) + $SSD --start -bm --pidfile $PID --exec $PROG -- $OPTS + ;; +stop) + $SSD --stop --remove-pidfile --retry 10 --pidfile $PID + ;; +restart) + $0 stop + $0 start + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac + +# End of file diff --git a/nfs-utils/rpc.mountd b/nfs-utils/rpc.mountd new file mode 100644 index 0000000..650ddc7 --- /dev/null +++ b/nfs-utils/rpc.mountd @@ -0,0 +1,36 @@ +#!/bin/sh +# +# /etc/rc.d/rpc.mountd: start/stop mountd daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/rpc.mountd +PID=/var/run/rpc.mountd.pid +OPTS="--foreground" + +case $1 in +start) + $SSD --start -bm --pidfile $PID --exec $PROG -- $OPTS + ;; +stop) + $SSD --stop --remove-pidfile --retry 10 --pidfile $PID + ;; +restart) + $0 stop + $0 start + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac + +# End of file diff --git a/nfs-utils/rpc.nfsd b/nfs-utils/rpc.nfsd new file mode 100644 index 0000000..9655a35 --- /dev/null +++ b/nfs-utils/rpc.nfsd @@ -0,0 +1,36 @@ +#!/bin/sh +# +# /etc/rc.d/rpc.nfsd: start/stop nfs daemons +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/rpc.nfsd +NAME="nfsd" +OPTS="--syslog" + +case $1 in +start) + $SSD --start --exec $PROG -- $OPTS 8 + ;; +stop) + $SSD --start --exec $PROG -- $OPTS 0 + ;; +restart) + $0 stop + $0 start + ;; +status) + $SSD --status --name $NAME + case $? in + 0) echo "$PROG is running" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac + +# End of file diff --git a/nfs-utils/rpc.statd b/nfs-utils/rpc.statd new file mode 100644 index 0000000..451d2b8 --- /dev/null +++ b/nfs-utils/rpc.statd @@ -0,0 +1,36 @@ +#!/bin/sh +# +# /etc/rc.d/rpc.statd: start/stop statd daemon +# + +SSD=/sbin/start-stop-daemon +PROG=/usr/sbin/rpc.statd +PID=/var/run/rpc.statd.pid +OPTS="--no-notify" + +case $1 in +start) + $SSD --start --pidfile $PID --exec $PROG -- $OPTS + ;; +stop) + $SSD --stop --retry 10 --pidfile $PID + ;; +restart) + $0 stop + $0 start + ;; +status) + $SSD --status --pidfile $PID + case $? in + 0) echo "$PROG is running" ;; + 1) echo "$PROG is not running but the pid file $PID exists" ;; + 3) echo "$PROG is not running" ;; + 4) echo "Unable to determine the program status" ;; + esac + ;; +*) + echo "usage: $0 [start|stop|restart|status]" + ;; +esac + +# End of file
participants (1)
-
crux@crux.nu