From 0f0b74e909a9f6a0dcaff48c4ad110c3ea450ef0 Mon Sep 17 00:00:00 2001
From: "Steinar H. Gunderson" <sesse@debian.org>
Date: Thu, 11 May 2006 12:42:13 +0200
Subject: [PATCH] Imported Debian patch 1.0.7-15

---
 debian/changelog           | 11 +++++++++++
 debian/nfs-common.dirs     |  1 -
 debian/nfs-common.init     |  9 +++++++++
 debian/nfs-common.postinst |  7 +++++--
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index f783345..07aa32e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+nfs-utils (1:1.0.7-15) unstable; urgency=low
+
+  * /var/lib/nfs/state is not a directory; it shouldn't really be mkdir-ed
+    or chowned (unless it already exists, in which case it should be
+    chowned). However, /var/lib/nfs should be owned by statd, so it can
+    create the file there. (Really Closes: #366654)
+  * umount /var/lib/nfs/rpc_pipefs on /etc/init.d/nfs-common stop; not doing
+    so could prevent purging of nfs-common.
+
+ -- Steinar H. Gunderson <sesse@debian.org>  Thu, 11 May 2006 12:42:13 +0200
+
 nfs-utils (1:1.0.7-14) unstable; urgency=high
 
   * urgency=high; fixes RC bugs (or at least, bugs that should have been RC).
diff --git a/debian/nfs-common.dirs b/debian/nfs-common.dirs
index 06e9733..7dbf8aa 100644
--- a/debian/nfs-common.dirs
+++ b/debian/nfs-common.dirs
@@ -3,6 +3,5 @@ sbin
 usr/sbin
 var/lib/nfs
 var/lib/nfs/sm
-var/lib/nfs/state
 var/lib/nfs/sm.bak
 var/lib/nfs/rpc_pipefs
diff --git a/debian/nfs-common.init b/debian/nfs-common.init
index 76ceaca..f90ee9a 100755
--- a/debian/nfs-common.init
+++ b/debian/nfs-common.init
@@ -113,6 +113,14 @@ do_mount() {
     return 0
 }
 
+do_umount() {
+    if mountpoint -q "$1"
+    then
+	umount "$1"
+    fi
+    return 0
+}
+
 # See how we were called.
 case "$1" in
   start)
@@ -180,6 +188,7 @@ case "$1" in
 	printf " statd"
 	start-stop-daemon --stop --oknodo --quiet \
 	    --name rpc.statd
+	do_umount $PIPEFS_MOUNTPOINT
 	echo "."
 	;;
 
diff --git a/debian/nfs-common.postinst b/debian/nfs-common.postinst
index ce8d59b..162f3c3 100755
--- a/debian/nfs-common.postinst
+++ b/debian/nfs-common.postinst
@@ -18,8 +18,11 @@ case "$1" in
 	if [ "$2" = "" ] || dpkg --compare-versions "$2" lt 1:1.0.7-13; then
 	    chown statd /var/lib/nfs/sm \
 		/var/lib/nfs/sm.bak \
-		/var/lib/nfs/state \
-		/var/lib/nfs/rpc_pipefs
+		/var/lib/nfs/rpc_pipefs \
+		/var/lib/nfs
+            if [ -f /var/lib/nfs/state ]; then
+	        chown statd /var/lib/nfs/state
+            fi
 	fi
     ;;
 esac
-- 
2.39.5