[nfs-utils/f16] Only enable services if they are enabled on upgrades (bz 807020)

Steve Dickson steved at fedoraproject.org
Tue May 15 19:32:28 UTC 2012


commit 6f6063e93e99af2d844752d48c4947d50aaea71f
Author: Steve Dickson <steved at redhat.com>
Date:   Tue May 15 15:30:47 2012 -0400

    Only enable services if they are enabled on upgrades (bz 807020)
    
    Signed-off-by: Steve Dickson <steved at redhat.com>

 nfs-utils.spec |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/nfs-utils.spec b/nfs-utils.spec
index 4444408..172d470 100644
--- a/nfs-utils.spec
+++ b/nfs-utils.spec
@@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser
 Name: nfs-utils
 URL: http://sourceforge.net/projects/nfs
 Version: 1.2.5
-Release: 6%{?dist}
+Release: 7%{?dist}
 Epoch: 1
 
 # group all 32bit related archs
@@ -192,8 +192,18 @@ else
 fi
 
 %post
-/bin/systemctl enable nfs-idmap.service >/dev/null 2>&1 || :
-/bin/systemctl enable nfs-lock.service >/dev/null 2>&1 || :
+if [ $1 -eq 1 ]; then
+	# Package install, not upgrade
+	/bin/systemctl enable nfs-idmap.service >/dev/null 2>&1 || :
+	/bin/systemctl enable nfs-lock.service >/dev/null 2>&1 || :
+else
+	# Package upgrade
+	for service in nfs-idmap.service nfs-idmap.service ; do
+		if /bin/systemctl --quiet is-enabled $service ; then
+			/bin/systemctl reenable $service >/dev/null 2>&1 || :
+		fi
+	done
+fi
 # Make sure statd used the correct uid/gid.
 chown -R rpcuser:rpcuser /var/lib/nfs/statd
 
@@ -279,6 +289,9 @@ fi
 %attr(4755,root,root)   /sbin/umount.nfs4
 
 %changelog
+* Tue May 15 2012 Steve Dickson <steved at redhat.com> 1.2.5-7
+- Only enable services if they are enabled on upgrades (bz 807020)
+
 * Mon Mar 26 2012 Steve Dickson <steved at redhat.com> 1.2.5-6
 - exportfs: Make sure exports are done after DNS is started (bz 770604)
 - gssd: Don't link with libgssapi_krb5 (bz 784908)


More information about the scm-commits mailing list