Decrease steps necessary to upgrading RPM packages fixed 48/7248/3
authorKristina Nevolnikova <knevolnikova@frinx.io>
Wed, 21 Jun 2017 12:20:42 +0000 (14:20 +0200)
committerDamjan Marion <dmarion.lists@gmail.com>
Wed, 12 Jul 2017 22:06:39 +0000 (22:06 +0000)
in %postun part and not call sysctl when VPP package is
upgrading provide by condition for sysctl --system
in %post part.

Change-Id: I549803864699e4a81cf589befe296d585e1c6d2b
Signed-off-by: Kristina Nevolnikova <knevolnikova@frinx.io>
extras/rpm/vpp.spec

index 1633e0f..fad25d2 100644 (file)
@@ -230,7 +230,9 @@ done
 %{_mu_build_dir}/scripts/remove-rpath %{buildroot}
 
 %post
-sysctl --system
+if [ $1 -eq 1 ] ; then
+    sysctl --system
+fi
 %systemd_post vpp.service
 
 %preun
@@ -238,23 +240,27 @@ sysctl --system
 
 %postun
 %systemd_postun
-
-# Unbind user-mode PCI drivers
-removed=
-pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci`
-for d in $pci_dirs; do
-    for f in ${d}/*; do
-        [ -e "${f}/config" ] || continue
-        echo ${f##*/} > ${d}/unbind
-        basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}`
-        removed=y
+if [ $1 -eq 0 ] ; then
+    echo "Uninstalling, unbind user-mode PCI drivers"
+    # Unbind user-mode PCI drivers
+    removed=
+    pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci`
+    for d in $pci_dirs; do
+        for f in ${d}/*; do
+            [ -e "${f}/config" ] || continue
+            echo ${f##*/} > ${d}/unbind
+            basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}`
+            removed=y
+        done
     done
-done
-if [ -n "${removed}" ]; then
-    echo "There are changes in PCI drivers, rescaning"
-    echo 1 > /sys/bus/pci/rescan
+    if [ -n "${removed}" ]; then
+        echo "There are changes in PCI drivers, rescaning"
+        echo 1 > /sys/bus/pci/rescan
+    else
+        echo "There weren't PCI devices binded"
+    fi
 else
-    echo "There weren't PCI devices binded"
+    echo "Upgrading package, dont' unbind interfaces"
 fi
 
 %files