rpm: Don't attempt to restart on upgrade when using systemd
authorGeoffrey Thomas <geofft@mit.edu>
Sun, 11 Dec 2011 10:06:24 +0000 (05:06 -0500)
committerDerrick Brashear <shadow@dementix.org>
Tue, 3 Jan 2012 15:25:12 +0000 (07:25 -0800)
systemd is actually rather capable of leaving the OpenAFS client in an
incredibly broken state, thanks to its willingness to track services and
kill their processes. We should not attempt to restart the client on
upgrade, whether a normal upgrade or a migration from SysV initscripts.
In the former case, it's fine (and correct) for the old AFS to keep
running; in the latter case, the unit file is capable of correctly
shutting down an initscript-launched client. The same is true for the
OpenAFS server.

This brings the packaging in line with the SysV initscript code in the
specfile, which does not attempt to restart the service, as well as with
e.g. Debian's packaging, which uses --no-restart-on-upgrade.

While we're here, clean up a redundant BuildRequires on systemd-units.

Change-Id: I3b1771a7246f04be0e82765976664c50e0adae47
Reviewed-on: http://gerrit.openafs.org/6247
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/packaging/RedHat/openafs.spec.in

index 4e75077..8c1fdba 100644 (file)
@@ -316,7 +316,6 @@ To a kernel module for your running kernel, just run:
 Requires: binutils, openafs = %{version}
 %if 0%{?fedora} >= 15
 Requires: systemd-units
-BuildRequires: systemd-units
 Requires(post): systemd-units, systemd-sysv
 Requires(preun): systemd-units
 Requires(postun): systemd-units
@@ -347,7 +346,6 @@ Summary: OpenAFS Filesystem Server
 Group: Networking/Filesystems
 %if 0%{?fedora} >= 15
 Requires: systemd-units
-BuildRequires: systemd-units
 Requires(post): systemd-units, systemd-sysv
 Requires(preun): systemd-units
 Requires(postun): systemd-units
@@ -1390,17 +1388,9 @@ fi
 %if 0%{?fedora} >= 15
 %postun client
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart openafs-client.service >/dev/null 2>&1 || :
-fi
 
 %postun server
 /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart openafs-server.service >/dev/null 2>&1 || :
-fi
 %endif
 
 %if %{build_dkmspkg}
@@ -1466,12 +1456,8 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 # to migrate them to systemd targets
 /usr/bin/systemd-sysv-convert --save openafs-client >/dev/null 2>&1 ||:
 
-# If the package is allowed to autostart:
-/bin/systemctl --no-reload enable openafs-client.service >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
+# Run this because the SysV package being removed won't do it
 /sbin/chkconfig --del openafs-client >/dev/null 2>&1 || :
-/bin/systemctl try-restart openafs-client.service >/dev/null 2>&1 || : 
 
 %triggerun -- openafs-server < 1.6.0-1
 # Save the current service runlevel info
@@ -1479,12 +1465,8 @@ dkms remove -m %{name} -v %{dkms_version} --rpm_safe_upgrade --all ||:
 # to migrate them to systemd targets
 /usr/bin/systemd-sysv-convert --save openafs-server >/dev/null 2>&1 ||:
 
-# If the package is allowed to autostart:
-/bin/systemctl --no-reload enable openafs-server.service >/dev/null 2>&1 ||:
-
-# Run these because the SysV package being removed won't do them
+# Run this because the SysV package being removed won't do it
 /sbin/chkconfig --del openafs-server >/dev/null 2>&1 || :
-/bin/systemctl try-restart openafs-server.service >/dev/null 2>&1 || : 
 %endif
 
 ##############################################################################