aboutsummaryrefslogtreecommitdiffstats
path: root/src/pkg/debian/vpp.postrm
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-18 13:28:22 +0100
committerDamjan Marion <dmarion@me.com>2019-01-20 16:14:24 +0000
commit4d2f86a1ebcfc952080386603354c4767d2c8825 (patch)
treed20ed373877bfbf145d3b7ed0773a0cdbfaee32e /src/pkg/debian/vpp.postrm
parente67c1d8242fec255e7449fedcbdec5c66bb3f7b2 (diff)
Rework of debian packaging
Change-Id: Ifede85d3af36f3ee6c6f8f92dcf5db0ed8f1bfeb Signed-off-by: Damjan Marion <damarion@cisco.com> Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/pkg/debian/vpp.postrm')
-rw-r--r--src/pkg/debian/vpp.postrm21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pkg/debian/vpp.postrm b/src/pkg/debian/vpp.postrm
new file mode 100644
index 00000000000..24b4842fd0a
--- /dev/null
+++ b/src/pkg/debian/vpp.postrm
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+removed=
+
+# Unbind user-mode PCI drivers
+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
+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
+