diff --git a/templates/nfs-utils/files/exports b/templates/nfs-utils/files/exports new file mode 100644 index 00000000000..742783ae5f2 --- /dev/null +++ b/templates/nfs-utils/files/exports @@ -0,0 +1,6 @@ +# /etc/exports +# +# See exports(5) for more information. +# +# Use exportfs -r to reread +# /export 192.168.1.10(rw,no_root_squash) diff --git a/templates/nfs-utils/files/mountd b/templates/nfs-utils/files/mountd deleted file mode 100755 index 6374a725a8d..00000000000 --- a/templates/nfs-utils/files/mountd +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# 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() -{ - /usr/sbin/exportfs -r -} - -load_rc_config $name -run_rc_command "$1" diff --git a/templates/nfs-utils/files/mountd.rc b/templates/nfs-utils/files/mountd.rc new file mode 100644 index 00000000000..8e46fa4a7c8 --- /dev/null +++ b/templates/nfs-utils/files/mountd.rc @@ -0,0 +1,13 @@ +#!/sbin/runscript + +# Disable v1 and v2 by default. +: ${mountd_args:=--no-nfs-version 1 --no-nfs-version 2} + +command=/usr/sbin/rpc.mountd +command_args=$mountd_args +name="RPC Mountd daemon" + +depend() +{ + need nfslock +} diff --git a/templates/nfs-utils/files/nfsd b/templates/nfs-utils/files/nfsd deleted file mode 100755 index 865dca0e20b..00000000000 --- a/templates/nfs-utils/files/nfsd +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# -# PROVIDE: nfsd -# REQUIRE: mountd -# KEYWORD: shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="nfsd" -rcvar=$name -command="/usr/sbin/rpc.nfsd" -start_cmd="nfsd_start_cmd" -stop_cmd="nfsd_stop_cmd" -status_cmd="nfsd_status_cmd" -pidfile="/var/run/${name}.pid" - -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/nfsd.rc b/templates/nfs-utils/files/nfsd.rc new file mode 100644 index 00000000000..3d68912e852 --- /dev/null +++ b/templates/nfs-utils/files/nfsd.rc @@ -0,0 +1,30 @@ +#!/sbin/runscript + +# By default start up 8 server threads. +: ${nfsd_args:=8} + +command=/usr/sbin/rpc.nfsd +command_args=$nfsd_args +pidfile=/var/run/nfsd.pid +name="RPC Network File System daemon" + +depend() +{ + use procfs + need mountd +} + +start_post() +{ + echo $(pidof -o %PPID nfsd) > $pidfile + sm-notify ${smnotify_args} +} + +stop() +{ + # Unexport all directories before. + exportfs -au + ebegin "Stopping $name" + kill -9 $(cat $pidfile) && rm -f $pidfile + eend $? +} diff --git a/templates/nfs-utils/files/nfslock b/templates/nfs-utils/files/nfslock deleted file mode 100755 index 723e4aebf8f..00000000000 --- a/templates/nfs-utils/files/nfslock +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -# -# PROVIDE: nfslock -# REQUIRE: portmap -# KEYWORD: shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="nfslock" -rcvar=$name -command="/usr/sbin/rpc.statd" -pidfile="/var/run/rpc.statd.pid" - -load_rc_config $name -run_rc_command "$1" diff --git a/templates/nfs-utils/files/nfslock.rc b/templates/nfs-utils/files/nfslock.rc new file mode 100644 index 00000000000..d142c5c195e --- /dev/null +++ b/templates/nfs-utils/files/nfslock.rc @@ -0,0 +1,11 @@ +#!/sbin/runscript + +command=/usr/sbin/rpc.statd +command_args=$nfslock_args +pidfile=/var/run/rpc.statd.pid +name="RPC Statd daemon" + +depend() +{ + need portmap +} diff --git a/templates/nfs-utils/template b/templates/nfs-utils/template index 46f9fb23ac4..f73af5c6675 100644 --- a/templates/nfs-utils/template +++ b/templates/nfs-utils/template @@ -1,30 +1,36 @@ # Template file for 'nfs-utils' pkgname=nfs-utils -version=1.1.5 -revision=1 +version=1.1.6 distfiles="http://downloads.sf.net/nfs/$pkgname-$version.tar.bz2" build_style=gnu_configure configure_args="--with-statduser=nobody --disable-gss --disable-nfsv4 --enable-nfsv3 --with-statedir=/var/lib/nfs --enable-mount" short_desc="Network File System utilities" maintainer="Juan RP " -checksum=9a5da7cd85dc9087222ab348ce82577c38547177d5d4dc7fccc9e939c97d47dc +checksum=9c7b4ba94cad4751604c31b9e428b0233b944fcb8ba89eebbd50e78cff73a5d5 long_desc=" The $pkgname package provides a daemon for the kernel NFS server and related tools, which provides a much higher level of performance than the traditional Linux NFS server used by most users." +openrc_services="mountd default nfsd default nfslock default" +triggers="openrc-service" + +conf_files="/etc/exports" + Add_dependency full glibc Add_dependency full portmap Add_dependency build e2fsprogs Add_dependency build tcp_wrappers Add_dependency run e2fsprogs-libs Add_dependency run tcp_wrappers-libs +Add_dependency run OpenRC post_install() { - # Install the rc.d scripts. + # Install the OpenRC services. for f in mountd nfsd nfslock; do - install -D -m755 ${FILESDIR}/${f} ${DESTDIR}/etc/rc.d/${f} + install -D -m755 ${FILESDIR}/${f}.rc ${DESTDIR}/etc/init.d/${f} done + install -D -m644 ${FILESDIR}/exports ${DESTDIR}/etc/exports }