require nfsbind replacing portmap

nfslock initscript: remove pid files on stop and make better checks on start [release 1.2.9-3mamba;Sat May 10 2014]
This commit is contained in:
Silvan Calarco 2024-01-06 07:37:49 +01:00
parent 873c0b34d9
commit 5a46c160ef
10 changed files with 992 additions and 0 deletions

View File

@ -1,2 +1,5 @@
# nfs-utils
The nfs-utils 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.
This package also contains the showmount program. Showmount queries the mount daemon on a remote host for information about the NFS (Network File System) server on the remote host. For example, showmount can display the clients which are mounted on that host.

View File

@ -0,0 +1,13 @@
diff --git a/utils/blkmapd/device-process.c b/utils/blkmapd/device-process.c
index 27ff374..652a7a8 100644
--- a/utils/blkmapd/device-process.c
+++ b/utils/blkmapd/device-process.c
@@ -296,7 +296,7 @@ decode_blk_volume(uint32_t **pp, uint32_t *end, struct bl_volume *vols, int voln
off_t stripe_unit = vol->param.bv_stripe_unit;
/* Check limitations imposed by device-mapper */
if ((stripe_unit & (stripe_unit - 1)) != 0
- || stripe_unit < (off_t) (PAGE_SIZE >> 9))
+ || stripe_unit < (off_t) (sysconf(_SC_PAGE_SIZE) >> 9))
return -EIO;
BLK_READBUF(p, end, 4);
READ32(vol->bv_vol_n);

10
nfs-utils-idmapd.conf Normal file
View File

@ -0,0 +1,10 @@
[General]
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = localdomain
[Mapping]
Nobody-User = nobody
Nobody-Group = nobody

170
nfs-utils-nfs.init Normal file
View File

@ -0,0 +1,170 @@
#!/bin/sh
#
# nfs This shell script takes care of starting and stopping
# the NFS services.
#
# chkconfig: - 55 15
# description: NFS is a popular protocol for file sharing across TCP/IP \
# networks. This service provides NFS server functionality, \
# which is configured via the /etc/exports file.
# probe: true
# config: /etc/sysconfig/nfs
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -x /usr/sbin/rpc.nfsd ] || exit 0
[ -x /usr/sbin/rpc.mountd ] || exit 0
[ -x /usr/sbin/exportfs ] || exit 0
# Don't fail if /etc/exports doesn't exist; create a bare-bones version and continue.
[ -r /etc/exports ] || \
{ touch /etc/exports && chmod u+rw,g+r,o+r /etc/exports ; } || \
{ echo "/etc/exports does not exist" ; exit 0 ; }
# Check for and source configuration file otherwise set defaults
[ -r /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
[ -z "$MOUNTD_NFS_V2" ] && MOUNTD_NFS_V2=default
[ -z "$MOUNTD_NFS_V3" ] && MOUNTD_NFS_V3=default
# Number of servers to be started by default
[ -z "$RPCNFSDCOUNT" ] && RPCNFSDCOUNT=8
# Remote quota server
[ -z "$RQUOTAD" ] && RQUOTAD=`type -path rpc.rquotad`
# See how we were called.
case "$1" in
start)
# Start daemons.
[ -x /sbin/rpc.statd ] && /sbin/service nfslock start
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd start
action $"Starting NFS services: " /usr/sbin/exportfs -r
# Set the ports lockd should listen on
if [ -n "$LOCKD_TCPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_tcpport=$LOCKD_TCPPORT >/dev/null 2>&1
fi
if [ -n "$LOCKD_UDPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_udpport=$LOCKD_UDPPORT >/dev/null 2>&1
fi
if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
echo -n $"Starting NFS quotas: "
[ -n "$RQUOTAD_PORT" ] \
&& RPCRQUOTADOPTS="$RPCRQUOTADOPTS -p $RQUOTAD_PORT"
daemon rpc.rquotad $RPCRQUOTADOPTS
echo
fi
echo -n $"Starting NFS daemon: "
daemon rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT
echo
[ -n "$MOUNTD_PORT" ] \
&& RPCMOUNTDOPTS="$RPCMOUNTDOPTS -p $MOUNTD_PORT"
case $MOUNTD_NFS_V1 in
no|NO)
RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 1" ;;
esac
case $MOUNTD_NFS_V2 in
no|NO)
RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 2" ;;
esac
case $MOUNTD_NFS_V3 in
no|NO)
RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3" ;;
esac
echo -n $"Starting NFS mountd: "
daemon rpc.mountd $RPCMOUNTDOPTS
echo
touch /var/lock/subsys/nfs
# Let rpc.idmapd know that rpc.mountd just started
[ -x /usr/sbin/rpc.idmapd ] && /sbin/service rpcidmapd condstart
;;
stop)
# Stop daemons.
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd stop
echo -n $"Shutting down NFS mountd: "
killproc rpc.mountd
echo
echo -n $"Shutting down NFS daemon: "
killproc nfsd
echo
if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
echo -n $"Shutting down NFS quotas: "
killproc rpc.rquotad
echo
fi
# Reset the lockd ports if they were set
if [ -n "$LOCKD_TCPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_tcpport=0 >/dev/null 2>&1
fi
if [ -n "$LOCKD_UDPPORT" ]; then
/sbin/sysctl -w fs.nfs.nlm_udpport=0 >/dev/null 2>&1
fi
# Do it the last so that clients can still access the server
# when the server is running.
action $"Shutting down NFS services: " /usr/sbin/exportfs -au
rm -f /var/lock/subsys/nfs
;;
status)
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd status
status rpc.mountd
status nfsd
if [ -n "$RQUOTAD" -a "$RQUOTAD" != "no" ]; then
status rpc.rquotad
fi
;;
restart)
$0 stop
$0 start
;;
reload)
/usr/sbin/exportfs -r
touch /var/lock/subsys/nfs
;;
probe)
if [ ! -f /var/lock/subsys/nfs ] ; then
echo $"start"; exit 0
fi
/sbin/pidof rpc.mountd >/dev/null 2>&1; MOUNTD="$?"
/sbin/pidof nfsd >/dev/null 2>&1; NFSD="$?"
if [ $MOUNTD = 1 -o $NFSD = 1 ] ; then
echo $"restart"; exit 0
fi
if [ /etc/exports -nt /var/lock/subsys/nfs ] ; then
echo $"reload"; exit 0
fi
;;
condrestart)
[ -x /usr/sbin/rpc.svcgssd ] && /sbin/service rpcsvcgssd condrestart
[ -f /var/lock/subsys/nfs ] && {
$0 stop
$0 start
}
;;
*)
echo $"Usage: nfs {start|stop|status|restart|reload|condrestart}"
exit 1
esac
exit 0

31
nfs-utils-nfs.sysconfig Normal file
View File

@ -0,0 +1,31 @@
# For more information on nfs tuning, please see the NFS-HOWTO
# http://nfs.sourceforge.net/nfs-howto/
# Pass any additional options for mountd.
# MOUNTD_OPTIONS=
# Pin mountd to a given port rather than random one from portmapper
# MOUNTD_PORT=
# Don't advertise TCP for mount.
# MOUNTD_TCP=no
# NFS V3
# MOUNTD_NFS_V3=auto|yes|no
# NFS V2
# MOUNTD_NFS_V2=auto|yes|no
# The number of open file descriptors
# MOUNTD_OPEN_FILES=128
# Pass the number of instances of nfsd (8 is default; 16 or more
# might be needed to handle heavy client traffic)
# NFSDCOUNT=8
# Increase the memory limits on the socket input queues for
# the nfs processes .. NFS benchmark SPECsfs demonstrate a
# need for a larger than default size (64kb) .. setting
# TUNE_QUEUE to yes will set the values to 256kb.
# TUNE_QUEUE="yes"
# NFS_QS=262144

136
nfs-utils-nfslock.init Normal file
View File

@ -0,0 +1,136 @@
#!/bin/sh
#
# nfslock This shell script takes care of starting and stopping
# the NFS file locking service.
#
# chkconfig: 345 31 50
# description: NFS is a popular protocol for file sharing across \
# TCP/IP networks. This service provides NFS file \
# locking functionality.
# probe: true
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi
[ -r /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -x /sbin/rpc.statd ] || exit 0
RETVAL=0
if [ -n "${STATD_HOSTNAME}" ]; then
STATDARG="-n ${STATD_HOSTNAME}"
else
STATDARG=""
fi
start() {
# Make sure rpc.statd is not already running
if status rpc.statd > /dev/null; then
exit 0
fi
rm -f /var/lock/subsys/rpc.statd
# Make sure locks are recovered
rm -f /var/run/sm-notify.pid
# Start daemons.
# See if the kernel lockd should start up
# listening on a particular port
#
if [ -n "$LOCKD_TCPPORT" -o -n "$LOCKD_UDPPORT" ]; then
LOCKDARG=""
[ -n "$LOCKD_TCPPORT" ] && LOCKDARG="nlm_tcpport=$LOCKD_TCPPORT"
[ -n "$LOCKD_UDPPORT" ] && \
LOCKDARG="$LOCKDARG nlm_udpport=$LOCKD_UDPPORT"
[ -n "$LOCKDARG" ] && \
modprobe lockd $LOCKDARG
fi
echo -n $"Starting NFS statd: "
# See if a statd's local hostname is defined
[ -n "${STATD_HOSTNAME}" ] && STATDARG="$STATDARG -n ${STATD_HOSTNAME}"
# See if a statd's ports has been defined
[ -n "$STATD_PORT" ] && STATDARG="$STATDARG -p $STATD_PORT"
[ -n "$STATD_OUTGOING_PORT" ] \
&& STATDARG="$STATDARG -o $STATD_OUTGOING_PORT"
# See if we have an HA-callout program specified
[ -n "$STATD_HA_CALLOUT" ] \
&& STATDARG="$STATDARG -H $STATD_HA_CALLOUT"
daemon rpc.statd "$STATDARG"
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/nfslock
return $RETVAL
}
stop() {
# Stop daemons.
if [ -n "`pidofproc lockd`" ]; then
echo -n $"Stopping NFS locking: "
killproc lockd -KILL
echo
fi
echo -n $"Stopping NFS statd: "
killproc rpc.statd
RETVAL=0
echo
rm -f /var/lock/subsys/nfslock
rm -f /var/run/sm-notify.pid
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
if [ "$USERLAND_LOCKD" ]; then
status lockd
fi
status rpc.statd
;;
restart)
stop
start
;;
probe)
if [ ! -f /var/lock/subsys/nfslock ] ; then
echo $"start"; exit 0
fi
/sbin/pidof rpc.statd >/dev/null 2>&1; STATD="$?"
if [ "$USERLAND_LOCKD" ]; then
/sbin/pidof lockd >/dev/null 2>&1; LOCKD="$?"
else
LOCKD=0
fi
if [ $STATD = 1 -o $LOCKD = 1 ] ; then
echo $"restart"; exit 0
fi
;;
condrestart)
[ -f /var/lock/subsys/nfslock ] && {
stop
start
}
;;
*)
echo $"Usage: $0 {start|stop|status|restart|probe|condrestart}"
exit 1
esac
exit 0

104
nfs-utils-rpcgssd.init Normal file
View File

@ -0,0 +1,104 @@
#!/bin/bash
#
# rpcgssd Start up and shut down RPCSEC GSS daemon
#
# Authors: Chuck Lever <cel@netapp.com>
#
# chkconfig: 345 41 28
# description: Starts user-level daemon that manages RPCSEC GSS contexts \
# for the NFSv4 client.
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ ! -x /usr/sbin/rpc.gssd ] && exit 0
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
[ "${SECURE_NFS}" != "yes" ] && exit 0
# List of kernel modules to load
[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5"
# Try to use machine credentials by default
OPTIONS=""
RETVAL=0
LOCKFILE=/var/lock/subsys/rpcgssd
prog="rpc.gssd"
case "$1" in
start|condstart)
# Make sure the daemon is not already running.
if status $prog > /dev/null ; then
exit 0
fi
rm -f $LOCKFILE
echo -n $"Starting RPC gssd: "
# Load sunrpc which mounts the rpc_pipes fs.
[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
/sbin/modprobe sunrpc || exit 1
fi
# Load rpcsec modules
for i in ${SECURE_NFS_MODS}
do
if ! /sbin/lsmod | grep $i > /dev/null ; then
/sbin/modprobe $i || exit 1
fi
done
}
# Make sure the mount worked.
[ -z "${RPCMTAB}" ] && RPCMTAB=`grep -v '^#' /proc/mounts | \
awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
[ -z "${RPCMTAB}" ] && {
echo "Error: RPC MTAB does not exist."
exit 1
}
# Start daemon.
daemon $prog ${OPTIONS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
;;
stop)
# Stop daemon.
echo -n $"Shutting down RPC gssd: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
;;
status)
status rpc.gssd
RETVAL=$?
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart)
if [ -f $LOCKFILE ]; then
$0 restart
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condstart|condrestart|status}"
exit 1
esac
exit $RETVAL

87
nfs-utils-rpcidmapd.init Normal file
View File

@ -0,0 +1,87 @@
#!/bin/bash
#
# rpcidmapd Start up and shut down RPC name to UID/GID mapper
#
# Authors: Chuck Lever <cel@netapp.com>
#
# chkconfig: 345 40 27
# description: Starts user-level daemon for NFSv4 that maps user \
# names to UID and GID numbers.
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ ! -x /usr/sbin/rpc.idmapd ] && exit 0
OPTIONS=""
RETVAL=0
LOCKFILE=/var/lock/subsys/rpcidmapd
prog="rpc.idmapd"
case "$1" in
start|condstart)
# Make sure the daemon is not already running.
[ "$1" = "condstart" -a -n "`pidofproc $prog`" ] && {
killproc $prog "-SIGHUP" > /dev/null
exit 0
}
rm -f $LOCKFILE
echo -n $"Starting RPC idmapd: "
# mount the rpc_pipes fs.
[ -e /var/lib/nfs/rpc_pipefs/nfs ] || \
mount rpc_pipefs /var/lib/nfs/rpc_pipefs -t rpc_pipefs
# Make sure the mount worked.
[ -z "${RPCMTAB}" ] && RPCMTAB=`grep -v '^#' /proc/mounts | \
awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
[ -z "${RPCMTAB}" ] && {
echo "Error: RPC MTAB does not exist."
exit 1
}
# Start daemon.
daemon $prog ${OPTIONS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
;;
stop)
# Stop daemon.
echo -n $"Shutting down RPC idmapd: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
;;
status)
status rpc.idmapd
RETVAL=$?
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart)
if [ -f $LOCKFILE ]; then
$0 restart
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condstart|condrestart|status}"
exit 1
esac
exit $RETVAL

103
nfs-utils-rpcsvcgssd.init Normal file
View File

@ -0,0 +1,103 @@
#!/bin/bash
#
# rpcsvcgssd Start up and shut down RPCSEC GSS daemon
#
# Authors: Chuck Lever <cel@netapp.com>
#
# chkconfig: - 41 28
# description: Starts user-level daemon that manages RPCSEC GSS contexts \
# for the NFSv4 server.
# Source function library.
. /etc/init.d/functions
# Source networking configuration.
if [ ! -f /etc/sysconfig/network ]; then
exit 0
fi
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ ! -x /usr/sbin/rpc.svcgssd ] && exit 0
# Check for and source configuration file otherwise set defaults
[ -f /etc/sysconfig/nfs ] && . /etc/sysconfig/nfs
[ "${SECURE_NFS}" != "yes" ] && exit 0
# List of kernel modules to load
[ -z "${SECURE_NFS_MODS}" ] && SECURE_NFS_MODS="des rpcsec_gss_krb5"
OPTIONS=""
RETVAL=0
LOCKFILE=/var/lock/subsys/rpcsvcgssd
prog="rpc.svcgssd"
case "$1" in
start|condstart)
# Make sure the daemon is not already running.
if status $prog > /dev/null ; then
exit 0
fi
rm -f $LOCKFILE
echo -n $"Starting RPC svcgssd: "
# Load sunrpc which mounts the rpc_pipes fs.
[ -x /sbin/lsmod -a -x /sbin/modprobe ] && {
if ! /sbin/lsmod | grep sunrpc > /dev/null ; then
/sbin/modprobe sunrpc || exit 1
fi
# Load rpcsec modules
for i in ${SECURE_NFS_MODS}
do
if ! /sbin/lsmod | grep $i > /dev/null ; then
/sbin/modprobe $i || exit 1
fi
done
}
# Make sure the mount worked.
[ -z "${RPCMTAB}" ] && RPCMTAB=`grep -v '^#' /proc/mounts | \
awk '{ if ($3 ~ /^rpc_pipefs$/ ) print $2}'`
[ -z "${RPCMTAB}" ] && {
echo "Error: RPC MTAB does not exist."
exit 1
}
# Start daemon.
daemon $prog ${OPTIONS}
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCKFILE
;;
stop)
# Stop daemon.
echo -n $"Shutting down RPC svcgssd: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCKFILE
;;
status)
status rpc.svcgssd
RETVAL=$?
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
condrestart)
if [ -f $LOCKFILE ]; then
$0 restart
RETVAL=$?
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condstart|condrestart|status}"
exit 1
esac
exit $RETVAL

335
nfs-utils.spec Normal file
View File

@ -0,0 +1,335 @@
%define rpcuser_uid 65050
%define rpcuser_gid 65050
%define nobodygroupid 65013
%define nobodyuserid 65013
#%define nfsnobody_uid 65051
%define with_rquotad 1
%define with_mount 1
Name: nfs-utils
Version: 1.2.9
Release: 3mamba
Summary: NFS utilities and supporting clients and daemons for the kernel NFS server
Group: Network/File Systems
Vendor: openmamba
Distribution: openmamba
Packager: Davide Madrisan <davide.madrisan@gmail.com>
URL: http://nfs.sourceforge.net
#Source0: http://www.kernel.org/pub/linux/utils/nfs/nfs-utils-%{version}.tar.bz2
Source0: http://downloads.sourceforge.net/project/nfs/nfs-utils/%{version}/nfs-utils-%{version}.tar.bz2
Source1: nfs-utils-nfs.sysconfig
Source2: nfs-utils-nfs.init
Source3: nfs-utils-nfslock.init
Source4: nfs-utils-rpcidmapd.init
Source5: nfs-utils-rpcgssd.init
Source6: nfs-utils-rpcsvcgssd.init
Source7: nfs-utils-idmapd.conf
Patch0: %{name}-1.2.5-arm-PAGE_SIZE.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libblkid-devel
BuildRequires: libcap-devel
BuildRequires: libdevmapper-devel
BuildRequires: libe2fs-devel
BuildRequires: libevent-devel
BuildRequires: libgssglue-devel
BuildRequires: libtirpc-devel
BuildRequires: libkeyutils-devel
%if "%{stage1}" != "1"
BuildRequires: libkrb5-devel
%endif
BuildRequires: libnfsidmap-devel
BuildRequires: librpcsecgss-devel
BuildRequires: libuuid-devel
BuildRequires: libwrap-devel
## AUTOBUILDREQ-END
BuildRequires: chkconfig
BuildRequires: pkgconfig
# build libraries needed to support nfsv4
BuildRequires: tcp_wrappers-devel >= 7.6
Requires(pre): /sbin/nologin
Requires: rpcbind
BuildRoot: %{_tmppath}/%{name}-%{version}-root
# FIXME:
# configure: WARNING: could not locate SPKM3 header; will not have SPKM3 support
# Note for linux kernel 2.6.x :
# With 2.6 we have the option of having the kernel tell mountd when it
# gets a request from an unknown host, and mountd can give appropriate
# export information to the kernel. This removes the dependency on
# rmtab and means that the kernel only needs to know about currently
# active clients.
#
# To enable this new functionality, you need to:
#
# mount -t nfsd nfsd /proc/fs/nfs
#
# before running exportfs or mountd. It is recommended that all NFS
# services be protected from the internet-at-large by a firewall where
# that is possible.
%description
The nfs-utils 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.
This package also contains the showmount program. Showmount queries the mount daemon on a remote host for information about the NFS (Network File System) server on the remote host. For example, showmount can display the clients which are mounted on that host.
%prep
%setup -q
#%patch0 -p1
%build
# --disable-tirpc: we currently use portmap.
# Enabling tirpc causes nfs.mountd not to start when IPv6 is disabled
%configure \
--enable-nfsv4 \
--enable-tirpc \
%if "%{stage1}" == "1"
--disable-gss \
%else
--enable-gss \
%endif
%if %{with_mount}
--enable-mount \
%else
--disable-mount \
%endif
--with-tcp-wrappers \
--enable-shared \
--disable-static \
--with-statduser=rpcuser \
--with-start-statd=/sbin/start-statd \
%if "%{_host}" != "%{_build}"
--without-krb5 \
LDFLAGS="-L%{_prefix}/%{_host}/lib -lnsl -ldl -luuid -lgssglue -lrpcsecgss"
%endif
#% if %{with_rquotad}
# --enable-rquotad \
#% else
# --disable-rquotad \
#% endif
# --enable-nfsv3 \
# --enable-secure-statd
make all CC=%{_host}-gcc CFLAGS="%{optflags}" LDFLAGS="-lrpcsecgss"
#%if "%{_host}" != "%{_build}"
# LDFLAGS="-L%{_prefix}/%{_host}/lib -lnsl -ldl -luuid -l"
#%endif
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
install -d -m0755 %{buildroot}/sbin
%makeinstall statduser=$USER
mv %{buildroot}%{_sbindir}/{start-statd,rpc.statd} %{buildroot}/sbin
install -D -m 644 %{S:1} %{buildroot}%{_sysconfdir}/sysconfig/nfs
install -D -m 755 %{S:2} %{buildroot}%{_initrddir}/nfs
install -D -m 755 %{S:3} %{buildroot}%{_initrddir}/nfslock
install -D -m 755 %{S:4} %{buildroot}%{_initrddir}/rpcidmapd
install -D -m 755 %{S:5} %{buildroot}%{_initrddir}/rpcgssd
install -D -m 755 %{S:6} %{buildroot}%{_initrddir}/rpcsvcgssd
#install -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/idmapd.conf
install -d %{buildroot}/var/lib/nfs/rpc_pipefs
install -d %{buildroot}/var/lib/nfs/statd
install -d %{buildroot}/var/lib/nfs/v4recovery
touch %{buildroot}%{_sysconfdir}/exports
touch %{buildroot}/var/lib/nfs/rmtab
%pre
if [ $1 -ge 1 ]; then
/usr/sbin/groupadd -g %{rpcuser_gid} rpcuser 2>/dev/null
/usr/sbin/useradd -c "RPC Service User" \
-s /bin/false -u %{rpcuser_uid} -g rpcuser -d /var/lib/nfs rpcuser 2>/dev/null
/usr/sbin/groupadd nobody -g %{nobodygroupid} 2>/dev/null
/usr/sbin/useradd -c nobody -u %{nobodyuserid} -d /dev/null -g nobody \
-s /bin/false nobody 2>/dev/null
fi
exit 0
%post
if [ $1 -ge 1 ]; then
#/sbin/chkconfig --add nfs
/sbin/chkconfig --del nfslock
#/sbin/chkconfig --add rpcidmapd
#/sbin/chkconfig --add rpcgssd
#/sbin/chkconfig --add rpcsvcgssd
fi
exit 0
%postun
if [ $1 -ge 1 ]; then
for daemon in rpcidmapd rpcgssd nfs; do
service $daemon condrestart >/dev/null
done
fi
exit 0
%preun
if [ $1 -eq 0 ]; then
for daemon in nfs rpcidmapd rpcgssd rpcsvcgssd nfslock; do
service $daemon stop 2>/dev/null
/sbin/chkconfig --del $daemon
done
/usr/sbin/userdel rpcuser 2>/dev/null
/usr/sbin/groupdel rpcuser 2>/dev/null
rm -rf /var/lib/nfs/statd/*
rm -rf /var/lib/nfs/v4recovery/*
fi
exit 0
%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%if %{with_mount}
%attr(4755,root,root) /sbin/mount.nfs
%attr(4755,root,root) /sbin/mount.nfs4
%attr(4755,root,root) /sbin/umount.nfs
%attr(4755,root,root) /sbin/umount.nfs4
%endif
/sbin/osd_login
/sbin/start-statd
/sbin/rpc.statd
%{_sbindir}/blkmapd
%{_sbindir}/exportfs
%{_sbindir}/mountstats
%{_sbindir}/nfsdcltrack
%{_sbindir}/nfsidmap
%{_sbindir}/nfsiostat
%if "%{stage1}" != "1"
#%{_sbindir}/gss_clnt_send_err
#%{_sbindir}/gss_destroy_creds
%{_sbindir}/rpc.gssd
%{_sbindir}/rpc.svcgssd
%endif
%{_sbindir}/nfsstat
#%{_sbindir}/nhfsgraph
#%{_sbindir}/nhfsnums
#%{_sbindir}/nhfsrun
#%{_sbindir}/nhfsstone
%{_sbindir}/rpcdebug
%{_sbindir}/rpc.idmapd
%{_sbindir}/rpc.mountd
%{_sbindir}/rpc.nfsd
#%if %{with_rquotad}
#%{_sbindir}/rpc.rquotad
#%endif
%{_sbindir}/showmount
%{_sbindir}/sm-notify
%{_initrddir}/nfs
%{_initrddir}/nfslock
%{_initrddir}/rpcidmapd
%{_initrddir}/rpcgssd
%{_initrddir}/rpcsvcgssd
%config(noreplace) %{_sysconfdir}/exports
#%config(noreplace) %{_sysconfdir}/idmapd.conf
%config(noreplace) %{_sysconfdir}/sysconfig/nfs
%dir /var/lib/nfs
%dir %attr(700,rpcuser,rpcuser) /var/lib/nfs/statd
%dir /var/lib/nfs/v4recovery
%dir /var/lib/nfs/rpc_pipefs
%dir /var/lib/nfs/sm
%dir /var/lib/nfs/sm.bak
%config(noreplace) /var/lib/nfs/etab
%config(noreplace) /var/lib/nfs/rmtab
%config(noreplace) /var/lib/nfs/state
%config(noreplace) /var/lib/nfs/xtab
%{_mandir}/man5/exports.5*
#%exclude %{_mandir}/man5/idmapd.conf.5*
%{_mandir}/man5/nfs.5*
%{_mandir}/man7/nfsd.7*
%{_mandir}/man8/*
%doc COPYING linux-nfs/*
%changelog
* Sat May 10 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.9-3mamba
- require nfsbind replacing portmap
- nfslock initscript: remove pid files on stop and make better checks on start
* Sat May 10 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.9-2mamba
- x86_64: unstaged build
- fix path check for rpc.statd in nfs initscript
* Wed Nov 27 2013 Automatic Build System <autodist@mambasoft.it> 1.2.9-1mamba
- automatic version update by autodist
* Thu May 16 2013 Automatic Build System <autodist@mambasoft.it> 1.2.8-1mamba
- automatic version update by autodist
* Wed Aug 22 2012 Automatic Build System <autodist@mambasoft.it> 1.2.6-1mamba
- automatic version update by autodist
* Fri Mar 16 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.5-4mamba
- precreate nobody group and user
* Thu Feb 16 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.5-3mamba
- rebuilt with libkeyutils
* Mon Feb 06 2012 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.5-2mamba
- disable nfslock initscript, as rpc.statd is called by mount in clients now and by nfs init in server
- include directory /var/lib/nfs/sm to fix file locking support on client
* Sun Sep 25 2011 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.5-1mamba
- update to 1.2.5
* Thu Dec 03 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.0-4mamba
- remove /etc/idmapd.conf to fix conflict with libnfsidmap
* Sat Aug 01 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.0-3mamba
- exclude idmapd.conf man entry moved to libnfsidmap
* Fri Jul 17 2009 Davide Madrisan <davide.madrisan@gmail.com> 1.2.0-2mamba
- minor fix in the initscripts for nfsd and nfslock
* Thu Jun 11 2009 Automatic Build System <autodist@mambasoft.it> 1.2.0-1mamba
- automatic update by autodist
* Fri May 08 2009 Automatic Build System <autodist@mambasoft.it> 1.1.6-1mamba
- automatic update by autodist
* Wed Mar 11 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.5-1mamba
- automatic update by autodist
* Wed Oct 22 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.4-1mamba
- update to 1.1.4
- nfslock: activate service on install
* Fri Jun 06 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.1-1mamba
- update to 1.1.1
* Sat Jul 07 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.1.0-1mamba
- update to 1.1.0
- fixes rpcidmapd initscript (don't load module but mount rpc_pipefs)
* Tue May 08 2007 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.12-1mamba
- update to 1.0.12
- changed uid and gid of rpcuser and nfsnobody to avoid overlap (see resources db)
* Tue Jan 23 2007 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.10-1qilnx
- update to version 1.0.10 by autospec
- /sbin/rpcdebug moved to /usr/sbin directory
- dropped patch for gcc4 compiler
- fixed permissions for /var/lib/nfs/statd
* Fri Dec 02 2005 Silvan Calarco <silvan.calarco@mambasoft.it> 1.0.7-2qilnx
- rebuilt with new releases of libnfsidmap and libevent
- gcc4 patch applied
* Fri Apr 01 2005 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.7-1qilnx
- update to version 1.0.7 by autospec
- also fix security issue QSA-2005-035 (CAN-2004-1014)
- added /etc/exports to be compliant with LSB requirements
* Wed Nov 19 2003 Davide Madrisan <davide.madrisan@qilinux.it> 1.0.6-1qilnx
- first build