forked from pool/nfs-utils
This commit is contained in:
parent
466f766636
commit
4b95d2850c
@ -1,3 +1,11 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 13 13:19:33 CEST 2008 - werner@suse.de
|
||||
|
||||
- Fix boot script and use correct Stop tags
|
||||
- The nfs boot script uses lazy umount and terminates process
|
||||
on shutdown in case of causing busy mounts
|
||||
- The nfs boot script may parse /etc/fstab only once
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 23 16:42:58 CEST 2008 - hare@suse.de
|
||||
|
||||
|
@ -2,9 +2,16 @@
|
||||
# spec file for package nfs-utils (Version 1.1.2)
|
||||
#
|
||||
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
# upon. The license for this file, and modifications and additions to the
|
||||
# file, is the same license as for the pristine package itself (unless the
|
||||
# license for the pristine package is not an Open Source License, in which
|
||||
# case the license is the MIT License). An "Open Source License" is a
|
||||
# license that conforms to the Open Source Definition (Version 1.9)
|
||||
# published by the Open Source Initiative.
|
||||
|
||||
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
||||
#
|
||||
|
||||
@ -15,7 +22,7 @@ BuildRequires: e2fsprogs-devel gcc-c++ krb5-devel libevent libgssglue-devel lib
|
||||
Url: http://nfs.sourceforge.net
|
||||
Summary: Support Utilities for Kernel nfsd
|
||||
Version: 1.1.2
|
||||
Release: 13
|
||||
Release: 14
|
||||
Group: Productivity/Networking/NFS
|
||||
License: GPL v2 or later
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -267,6 +274,11 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%doc nfs/*.html nfs/*.ps linux-nfs/* README.NFSv4
|
||||
|
||||
%changelog
|
||||
* Wed Aug 13 2008 werner@suse.de
|
||||
- Fix boot script and use correct Stop tags
|
||||
- The nfs boot script uses lazy umount and terminates process
|
||||
on shutdown in case of causing busy mounts
|
||||
- The nfs boot script may parse /etc/fstab only once
|
||||
* Wed Jul 23 2008 hare@suse.de
|
||||
- Include mkinitrd scriptlets.
|
||||
- Do not install Makefiles for nfs-doc.
|
||||
|
210
nfs.init
210
nfs.init
@ -1,9 +1,10 @@
|
||||
#! /bin/bash
|
||||
# Copyright (c) 1996-2002 SuSE Linux AG, Nuernberg, Germany.
|
||||
# Copyright (c) 2008 SuSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Author: Florian La Roche, 1996
|
||||
# Werner Fink <werner@suse.de>, 1996
|
||||
# Werner Fink <werner@suse.de>, 1996,2008
|
||||
# Burchard Steinbild, 1996
|
||||
#
|
||||
# Please send feedback to http://www.suse.de/feedback
|
||||
@ -13,9 +14,9 @@
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nfs
|
||||
# Required-Start: $network $portmap
|
||||
# Required-Stop:
|
||||
# Required-Stop: $network $portmap
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop:
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: NFS client services
|
||||
# Description: All necessary services for NFS clients
|
||||
### END INIT INFO
|
||||
@ -31,32 +32,48 @@ IDMAPD_SERVER_STATE=/var/lock/subsys/nfsserver-rpc.idmapd
|
||||
|
||||
NEED_IDMAPD=no
|
||||
NEED_GSSD=no
|
||||
nfs=no
|
||||
NEED_LDCONFIG=no
|
||||
state=0
|
||||
usr=""
|
||||
opt=""
|
||||
mnt=""
|
||||
nfs=no
|
||||
|
||||
while read what where type options rest ; do
|
||||
case "$what" in
|
||||
\#*|"") ;;
|
||||
*) case "$options" in
|
||||
*noauto*) ;;
|
||||
*) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
|
||||
nfs=yes
|
||||
case "$where" in
|
||||
/usr*|/opt*)
|
||||
NEED_LDCONFIG=yes
|
||||
break
|
||||
;;
|
||||
*)
|
||||
if grep -q "^$where" /etc/ld.so.conf; then
|
||||
NEED_LDCONFIG=yes
|
||||
break;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi ;;
|
||||
esac
|
||||
\#*|"") continue ;;
|
||||
esac
|
||||
case ",$options," in
|
||||
*,noauto,*) continue ;;
|
||||
esac
|
||||
case "$type" in
|
||||
nfs|nfs4) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
nfs=yes
|
||||
if test "$1" = status ; then
|
||||
grep -qE "^$what[[:blank:]]+$where[[:blank:]]+nfs" /proc/mounts && continue
|
||||
state=3
|
||||
continue
|
||||
fi
|
||||
case "$where" in
|
||||
/usr*)
|
||||
usr="${usr:+$usr }$where"
|
||||
NEED_LDCONFIG=yes
|
||||
;;
|
||||
/opt*)
|
||||
opt="${opt:+$opt }$where"
|
||||
NEED_LDCONFIG=yes
|
||||
;;
|
||||
*)
|
||||
mnt="${mnt:+$mnt }$where"
|
||||
test "$NEED_LDCONFIG" = yes && continue
|
||||
grep -qE "^$where" /etc/ld.so.conf || continue
|
||||
NEED_LDCONFIG=yes
|
||||
;;
|
||||
esac
|
||||
done < /etc/fstab
|
||||
unset what where type options rest
|
||||
|
||||
case $NFS_SECURITY_GSS in
|
||||
[Nn]*) flavors="";;
|
||||
@ -64,17 +81,17 @@ case $NFS_SECURITY_GSS in
|
||||
*) flavors="$NFS_SECURITY_GSS";;
|
||||
esac
|
||||
|
||||
if [ "$flavors" ]; then
|
||||
if test -n "$flavors" ; then
|
||||
NEED_GSSD=yes
|
||||
fi
|
||||
|
||||
if [ "$NFS4_SUPPORT" = yes ]; then
|
||||
if test "$NFS4_SUPPORT" = yes ; then
|
||||
NEED_IDMAPD=yes
|
||||
fi
|
||||
|
||||
if [ -x /sbin/portmap ]; then
|
||||
if test -x /sbin/portmap ; then
|
||||
PORTMAP_BIN=/sbin/portmap
|
||||
elif [ -x /sbin/rpcbind ]; then
|
||||
elif test -x /sbin/rpcbind ; then
|
||||
PORTMAP_BIN=/sbin/rpcbind
|
||||
else
|
||||
echo "portmap/rpcbind is missing"
|
||||
@ -83,41 +100,41 @@ else
|
||||
rc_exit
|
||||
fi
|
||||
|
||||
echo
|
||||
mount_rpc_pipefs() {
|
||||
# See if the file system is there yet
|
||||
case `stat -c "%t" -f /var/lib/nfs/rpc_pipefs` in
|
||||
*67596969*)
|
||||
return 0;;
|
||||
esac
|
||||
|
||||
mount -t rpc_pipefs rpc_pipefs /var/lib/nfs/rpc_pipefs
|
||||
}
|
||||
|
||||
mount_usr() {
|
||||
while read what where type options rest ; do
|
||||
case "$what" in
|
||||
\#*|"") ;;
|
||||
*) case "$options" in
|
||||
*noauto*) ;;
|
||||
*) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
|
||||
case "$where" in
|
||||
/usr*)
|
||||
mount -o nolock $where
|
||||
break
|
||||
;;
|
||||
esac
|
||||
fi ;;
|
||||
esac
|
||||
esac
|
||||
done < /etc/fstab
|
||||
test -n "$usr" -o -n "$opt" || return
|
||||
local where
|
||||
for where in $usr $opt ; do
|
||||
mount -o nolock $where
|
||||
done
|
||||
}
|
||||
|
||||
close_usr() {
|
||||
test -n "$usr" -o -n "$opt" -o -n "$mnt" || return
|
||||
local -i proc=0
|
||||
local where
|
||||
for where in $usr $opt $mnt ; do
|
||||
fuser -skm -TERM $where && let proc++
|
||||
done
|
||||
test $proc -eq 0 && return
|
||||
sleep 5
|
||||
for where in $usr $opt $mnt ; do
|
||||
fuser -skm -KILL $where
|
||||
done
|
||||
}
|
||||
|
||||
do_start_gssd() {
|
||||
for flavor in $flavors; do
|
||||
/sbin/modprobe rpcsec_gss_$flavor
|
||||
done
|
||||
|
||||
mount_rpc_pipefs
|
||||
startproc $GSSD_BIN
|
||||
return $?
|
||||
@ -132,8 +149,8 @@ do_start_idmapd() {
|
||||
killproc -HUP $IDMAPD_BIN
|
||||
else
|
||||
startproc $IDMAPD_BIN
|
||||
return $?
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
rc_reset
|
||||
@ -141,27 +158,30 @@ case "$1" in
|
||||
start|reload)
|
||||
echo -n "Starting NFS client services:"
|
||||
if ! checkproc $PORTMAP_BIN ; then
|
||||
echo "portmap/rpcbind is not running"
|
||||
rc_failed 3
|
||||
rc_status -v
|
||||
rc_exit
|
||||
echo "portmap/rpcbind is not running"
|
||||
rc_failed 3
|
||||
rc_status -v
|
||||
rc_exit
|
||||
fi
|
||||
|
||||
# in case we need /usr via nfs
|
||||
# in case we need /usr and/or /opt via nfs
|
||||
mount_usr
|
||||
|
||||
# sm-notify
|
||||
echo -n " sm-notify"
|
||||
/usr/sbin/sm-notify $SM_NOTIFY_OPTIONS
|
||||
# gssd
|
||||
if [ "$NEED_GSSD" = yes ]; then
|
||||
|
||||
# start gssd
|
||||
if test "$NEED_GSSD" = yes ; then
|
||||
echo -n " gssd"
|
||||
do_start_gssd || {
|
||||
rc_status -v
|
||||
rc_exit
|
||||
}
|
||||
fi
|
||||
# idmapd
|
||||
if [ "$NEED_IDMAPD" = yes ]; then
|
||||
|
||||
# start idmapd
|
||||
if test "$NEED_IDMAPD" = yes ; then
|
||||
echo -n " idmapd"
|
||||
do_start_idmapd || {
|
||||
rc_status -v
|
||||
@ -169,9 +189,9 @@ case "$1" in
|
||||
}
|
||||
echo $IDMAPD_BIN > $IDMAPD_CLIENT_STATE
|
||||
fi
|
||||
# statd is started when needed by mount.nfs
|
||||
#
|
||||
if test "$nfs" = yes ; then
|
||||
|
||||
# remark: statd is started when needed by mount.nfs
|
||||
|
||||
# Mount all auto NFS devices (-> nfs(5) and mount(8) )
|
||||
# NFS-Server sometime not reachable during boot phase.
|
||||
# It's sometime usefull to mount NFS devices in
|
||||
@ -181,44 +201,41 @@ case "$1" in
|
||||
# sleep 2 && mount -at nfs,nfs4 &
|
||||
# sleep 2
|
||||
#
|
||||
# Note: Some people importing the /usr partition.
|
||||
# Therefore we do _NOT_ use an ampersand!
|
||||
#
|
||||
mount -at nfs,nfs4 > /dev/null 2>&1
|
||||
if test "$nfs" = yes ; then
|
||||
mount -at nfs,nfs4 > /dev/null 2>&1
|
||||
fi
|
||||
#
|
||||
# generate new list of available shared libraries
|
||||
#
|
||||
if test "$NEED_LDCONFIG" = yes; then
|
||||
rc_status
|
||||
sleep 1
|
||||
# check if ld.so.cache needs to be refreshed
|
||||
/etc/init.d/boot.ldconfig start > /dev/null 2>&1
|
||||
fi
|
||||
if test "$NEED_LDCONFIG" = yes; then
|
||||
# check if ld.so.cache needs to be refreshed
|
||||
/etc/init.d/boot.ldconfig start > /dev/null 2>&1
|
||||
fi
|
||||
#
|
||||
rc_status -v
|
||||
;;
|
||||
stop)
|
||||
echo -n "Shutting down NFS client services:"
|
||||
if test "$nfs" = "yes" ; then
|
||||
#
|
||||
# Unmount in background because during long timeouts
|
||||
#
|
||||
umount -at nfs,nfs4 &
|
||||
sleep 2
|
||||
fi
|
||||
#
|
||||
if [ "$NEED_GSSD" = yes ]; then
|
||||
# Unmount background because during long timeouts
|
||||
#
|
||||
if test "$nfs" = yes ; then
|
||||
umount -alt nfs,nfs4 &
|
||||
fi
|
||||
|
||||
# stop gssd
|
||||
if test "$NEED_GSSD" = yes ; then
|
||||
echo -n " gssd"
|
||||
killproc $GSSD_BIN || {
|
||||
rc_status -v
|
||||
rc_exit
|
||||
}
|
||||
fi
|
||||
#
|
||||
if [ "$NEED_IDMAPD" = yes ]; then
|
||||
|
||||
# stop idmapd
|
||||
if test "$NEED_IDMAPD" = yes ; then
|
||||
# only stop idmapd if it is not needed by server
|
||||
if [ ! -f $IDMAPD_SERVER_STATE ]; then
|
||||
if test ! -f $IDMAPD_SERVER_STATE ; then
|
||||
echo -n " idmapd"
|
||||
killproc $IDMAPD_BIN || {
|
||||
rc_status -v
|
||||
@ -227,6 +244,13 @@ case "$1" in
|
||||
fi
|
||||
rm -f $IDMAPD_CLIENT_STATE
|
||||
fi
|
||||
|
||||
# in case we have /usr and/or /opt via nfs terminate all
|
||||
# processes on them (nfsservers shouldn't do /usr via nfs)
|
||||
case "$RUNLEVEL" in
|
||||
[016sS]) close_usr ;;
|
||||
esac
|
||||
|
||||
#
|
||||
rc_status -v
|
||||
;;
|
||||
@ -239,28 +263,18 @@ case "$1" in
|
||||
;;
|
||||
status)
|
||||
echo -n "Checking for mounted nfs shares (from /etc/fstab):"
|
||||
if test "$nfs" = "yes" ; then
|
||||
while read what where type options rest ; do
|
||||
case "$what" in
|
||||
\#*|"") ;;
|
||||
*) case "$options" in
|
||||
*noauto*) ;;
|
||||
*) if test "$type" = "nfs" -o "$type" = "nfs4" ; then
|
||||
grep -q "$what $where nfs" /proc/mounts || rc_failed 3
|
||||
fi ;;
|
||||
esac
|
||||
esac
|
||||
done < /etc/fstab
|
||||
if test "$nfs" = yes ; then
|
||||
rc_failed $status
|
||||
else
|
||||
rc_failed 3
|
||||
rc_failed 3
|
||||
fi
|
||||
#
|
||||
if [ "$NEED_GSSD" = yes ] && ! checkproc $GSSD_BIN; then
|
||||
echo "gssd not running"
|
||||
rc_failed 3
|
||||
if test "$NEED_GSSD" = yes && ! checkproc $GSSD_BIN; then
|
||||
echo "gssd not running"
|
||||
rc_failed 3
|
||||
fi
|
||||
#
|
||||
if [ "$NEED_IDMAPD" = yes ] && ! checkproc $IDMAPD_BIN; then
|
||||
if test "$NEED_IDMAPD" = yes && ! checkproc $IDMAPD_BIN; then
|
||||
echo "idmapd not running"
|
||||
rc_failed 3
|
||||
fi
|
||||
@ -271,7 +285,7 @@ case "$1" in
|
||||
;;
|
||||
try-restart|condrestart)
|
||||
$0 status
|
||||
if test $? = 0; then
|
||||
if test $? -eq 0; then
|
||||
$0 restart
|
||||
else
|
||||
rc_reset
|
||||
|
@ -9,13 +9,13 @@
|
||||
# /etc/init.d/nfsserver
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: nfsserver
|
||||
# Provides: nfsserver
|
||||
# Required-Start: $network $named $portmap
|
||||
# Required-Stop: $network $portmap
|
||||
# Should-Start: ypbind krb5kdc
|
||||
# Should-Stop:
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Required-Stop: $network $portmap
|
||||
# Should-Start: ypbind krb5kdc
|
||||
# Should-Stop: ypbind krb5kdc
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Short-Description: Start the kernel based NFS daemon
|
||||
### END INIT INFO
|
||||
|
||||
@ -149,8 +149,8 @@ do_start_idmapd() {
|
||||
killproc -HUP $IDMAPD_BIN
|
||||
else
|
||||
startproc $IDMAPD_BIN
|
||||
return $?
|
||||
fi
|
||||
return $?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
Loading…
x
Reference in New Issue
Block a user