2013-03-16 18:52:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2014-05-29 03:12:42 +00:00
|
|
|
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
|
|
|
|
2013-03-16 18:52:16 +00:00
|
|
|
# Find all networking devices currenly installed...
|
2015-06-15 01:26:04 +00:00
|
|
|
HIDE_PCI="`lspci -mm -n | grep '^[^ ]* "02'|awk '{print $1}'`"
|
2013-03-16 18:52:16 +00:00
|
|
|
|
2015-06-15 01:26:04 +00:00
|
|
|
# ... and optionally all USB controllers...
|
2014-05-29 03:12:42 +00:00
|
|
|
if getargbool 0 rd.qubes.hide_all_usb; then
|
2015-06-15 01:26:04 +00:00
|
|
|
HIDE_PCI="$HIDE_PCI `lspci -mm -n | grep '^[^ ]* "0c03'|awk '{print $1}'`"
|
2014-05-29 03:12:42 +00:00
|
|
|
fi
|
|
|
|
|
2015-06-15 01:26:04 +00:00
|
|
|
HIDE_PCI="$HIDE_PCI `getarg rd.qubes.hide_pci | tr ',' ' '`"
|
2014-05-29 03:12:42 +00:00
|
|
|
|
2015-06-15 01:26:04 +00:00
|
|
|
modprobe xen-pciback 2>/dev/null || :
|
2013-03-16 18:52:16 +00:00
|
|
|
|
2015-06-15 01:26:04 +00:00
|
|
|
# ... and hide them so that Dom0 doesn't load drivers for them
|
|
|
|
for dev in $HIDE_PCI; do
|
|
|
|
BDF=0000:$dev
|
|
|
|
if [ -e /sys/bus/pci/devices/$BDF/driver ]; then
|
|
|
|
echo -n $BDF > /sys/bus/pci/devices/$BDF/driver/unbind
|
|
|
|
fi
|
2015-07-01 05:16:59 +00:00
|
|
|
echo -n $BDF > /sys/bus/pci/drivers/pciback/new_slot
|
2015-06-15 01:26:04 +00:00
|
|
|
echo -n $BDF > /sys/bus/pci/drivers/pciback/bind
|
|
|
|
done
|