From 8ae1873a3f3368a942a1b02e7d4b60b005364a90 Mon Sep 17 00:00:00 2001 From: Kristina Nevolnikova Date: Wed, 21 Jun 2017 14:20:42 +0200 Subject: Decrease steps necessary to upgrading RPM packages fixed 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 --- extras/rpm/vpp.spec | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'extras/rpm/vpp.spec') diff --git a/extras/rpm/vpp.spec b/extras/rpm/vpp.spec index 1633e0ff76a..fad25d2212e 100644 --- a/extras/rpm/vpp.spec +++ b/extras/rpm/vpp.spec @@ -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 -- cgit 1.2.3-korg