You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-installer-qubes-os/anaconda/dracut/find-net-intfs-by-driver

24 lines
530 B

#!/bin/bash
#
# Find all devices which depend on input kernel driver.
#
# Author: Jiri Konecny
#
driver="$1"
# List all interfaces in system
for i in /sys/class/net/*/device/modalias; do
if [ -z $i ]; then
exit 0
fi
# Get kernel mods on which the interface is dependent
d=$(modprobe -R $(cat "$i"))
# Test if this is the mod we are looking for. If so return name of the interface.
if [[ " $d " == *\ $driver\ * ]]; then
intf=${i%%/device/modalias}
echo "${intf##*/}"
fi
done