From 319eba8deb0d776324d360a25d5cf241ca38cbee Mon Sep 17 00:00:00 2001 From: Nagendra Chandran Date: Mon, 26 Sep 2016 16:13:56 -0700 Subject: [PATCH] Remove symlink to vrouter.ko only during uninstallation RPM Scriplets execution order during upgrade, installs the new package first followed by new packages's postinst and then preun script of old package Because of this, symlink gets removed during contrail upgrade Closes-Bug: 1623413 Change-Id: I122129608e8fd4749968b610987131162c62e46e --- rpm/contrail/contrail.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/rpm/contrail/contrail.spec b/rpm/contrail/contrail.spec index 1c9b8992..9a60d43a 100644 --- a/rpm/contrail/contrail.spec +++ b/rpm/contrail/contrail.spec @@ -160,8 +160,14 @@ The OpenContrail vRouter is conceptually similar to existing commercial and open The package opencontrail-vrouter-dkms provides the OpenContrail Linux kernel module. %preun vrouter -if [ -L /lib/modules/$(uname -r)/extra/net/vrouter/vrouter.ko ]; then - rm -f /lib/modules/$(uname -r)/extra/net/vrouter/vrouter.ko +# Execute only during uninstall, skip during upgrade +if [ $1 == 0 ]; then + if [ -L /lib/modules/$(uname -r)/extra/net/vrouter/vrouter.ko ]; then + echo "Removing symbolic link /lib/modules/$(uname -r)/extra/net/vrouter/vrouter.ko" + rm -f /lib/modules/$(uname -r)/extra/net/vrouter/vrouter.ko + fi +else + echo "Skip removing /lib/modules/$(uname -r)/extra/net/vrouter/vrouter.ko for upgrade" fi exit 0