xenserver: Run "depmod" after old modules are removed by "rpm -U".
authorBen Pfaff <blp@nicira.com>
Tue, 14 Jun 2011 17:36:56 +0000 (10:36 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 28 Jul 2011 18:21:57 +0000 (11:21 -0700)
http://fedoraproject.org/wiki/Packaging/ScriptletSnippets says that
package upgrade does the following steps:

    1.  %pretrans of new package
    2.  %pre of new package
    3. (package install)
    4.  %post of new package
    5.  %triggerin of other packages (set off by installing new package)
    6.  %triggerin of new package (if any are true)
    7.  %triggerun of old package (if it's set off by uninstalling the old
       package)
    8.  %triggerun of other packages (set off by uninstalling old package)
    9.  %preun of old package
   10. (removal of old package)
   11.  %postun of old package
   12.  %triggerpostun of old package (if it's set off by uninstalling the
       old package)
   13.  %triggerpostun of other packages (if they're setu off by
       uninstalling the old package)
   14.  %posttrans of new package

We're getting in trouble because the %post runs in step 4 before the
old files are removed in step 10, so depmod is finding the old modules.
This commit switches to running depmod in step 14 instead, after the
old files are removed.

Bug #5916.
Reported-by: Jesse Gross <jesse@nicira.com>
Reported-by: Henrik Amren <henrik@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
xenserver/openvswitch-xen.spec

index 492e0dc..227c072 100644 (file)
@@ -244,8 +244,14 @@ else    # $1 = 2 for upgrade
     printf "\n\n"
 fi
 
-%post %{module_package}
+%posttrans %{module_package}
 # Ensure that modprobe will find our modules.
+#
+# This has to be in %posttrans instead of %post because older versions
+# installed modules into a different directory and "rpm -U" runs the
+# new version's %post before removing the old version's files, so if
+# we use %post then depmod may find the old versions that are about to
+# be removed.
 depmod %{xen_version}
 
 %preun