From 575ce29b3713de656fa73ce366fd5bfa36f863c8 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 28 Mar 2009 11:27:08 +0100 Subject: [PATCH] nfs-utils: reworked the rc.d scripts to make server/client work. Bump revision. --HG-- extra : convert_revision : 8ae516e972fa5ba22be2d5ef80194bf08ff921fa --- templates/nfs-utils/files/mountd | 2 ++ templates/nfs-utils/files/nfsd | 55 +++++++++++++++++++++++++++++-- templates/nfs-utils/files/nfslock | 13 ++------ templates/nfs-utils/template | 1 + 4 files changed, 58 insertions(+), 13 deletions(-) diff --git a/templates/nfs-utils/files/mountd b/templates/nfs-utils/files/mountd index b7e8064e1a..6374a725a8 100755 --- a/templates/nfs-utils/files/mountd +++ b/templates/nfs-utils/files/mountd @@ -2,12 +2,14 @@ # # PROVIDE: mountd # REQUIRE: portmap nfslock +# KEYWORD: shutdown $_rc_subr_loaded . /etc/rc.subr name="mountd" rcvar=$name command="/usr/sbin/rpc.mountd" +procname=${command} start_precmd="mountd_precmd" mountd_precmd() diff --git a/templates/nfs-utils/files/nfsd b/templates/nfs-utils/files/nfsd index 60acef34ae..865dca0e20 100755 --- a/templates/nfs-utils/files/nfsd +++ b/templates/nfs-utils/files/nfsd @@ -2,18 +2,69 @@ # # PROVIDE: nfsd # REQUIRE: mountd +# KEYWORD: shutdown $_rc_subr_loaded . /etc/rc.subr name="nfsd" rcvar=$name command="/usr/sbin/rpc.nfsd" -start_postcmd="nfsd_postcmd" +start_cmd="nfsd_start_cmd" +stop_cmd="nfsd_stop_cmd" +status_cmd="nfsd_status_cmd" +pidfile="/var/run/${name}.pid" -nfsd_postcmd() +nfsd_start_cmd() { + # + # Load the nfsd module to make the mount call + # succeed. + # + modprobe -q nfsd + + # + # By default start up 8 threads. + # + [ -z "${nfsd_flags}" ] && nfsd_flags="8" + + # Check for /proc/fs/nfsd + if grep -qs nfsd /proc/filesystems ; then + if ! grep -qs "nfsd /proc/fs/nfsd" /proc/mounts ; then + mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd + fi + fi + ${command} ${nfsd_flags} + echo $(pidof -o %PPID ${name}) > ${pidfile} + echo "Starting ${name}." + /usr/sbin/sm-notify ${smnotify_args} } +nfsd_stop_cmd() +{ + # + # Unexport all directories before. + # + exportfs -au + + if [ -f ${pidfile} ]; then + PID=$(cat ${pidfile}) + kill ${PID} + rm -f ${pidfile} + fi + echo "Stopped ${name}." +} + +nfsd_status_cmd() +{ + if [ ! -f ${pidfile} ]; then + echo "${name} is not running." + return 0 + fi + + PID=$(cat ${pidfile}) + echo "${name} is running with PIDs: ${PID}" +} + load_rc_config $name run_rc_command "$1" diff --git a/templates/nfs-utils/files/nfslock b/templates/nfs-utils/files/nfslock index e940444d4d..723e4aebf8 100755 --- a/templates/nfs-utils/files/nfslock +++ b/templates/nfs-utils/files/nfslock @@ -2,23 +2,14 @@ # # PROVIDE: nfslock # REQUIRE: portmap +# KEYWORD: shutdown $_rc_subr_loaded . /etc/rc.subr name="nfslock" rcvar=$name command="/usr/sbin/rpc.statd" -start_precmd="statd_precmd" - -statd_precmd() -{ - # Check for /proc/fs/nfsd - if grep -qs nfsd /proc/filesystems ; then - if ! grep -qs "nfsd /proc/fs/nfsd" /proc/mounts ; then - mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd - fi - fi -} +pidfile="/var/run/rpc.statd.pid" load_rc_config $name run_rc_command "$1" diff --git a/templates/nfs-utils/template b/templates/nfs-utils/template index f0b2b358c7..46f9fb23ac 100644 --- a/templates/nfs-utils/template +++ b/templates/nfs-utils/template @@ -1,6 +1,7 @@ # Template file for 'nfs-utils' pkgname=nfs-utils version=1.1.5 +revision=1 distfiles="http://downloads.sf.net/nfs/$pkgname-$version.tar.bz2" build_style=gnu_configure configure_args="--with-statduser=nobody --disable-gss --disable-nfsv4