setup.sh: try harder to find out if driver is loaded
Change-Id: I098285ff42271a7577a260cd864c015b235833b5 Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-on: https://review.gerrithub.io/c/443765 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/448425 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
parent
b60101300f
commit
42f24e153a
@ -60,18 +60,19 @@ function usage()
|
||||
}
|
||||
|
||||
# In monolithic kernels the lsmod won't work. So
|
||||
# back that with a /sys/modules check. Return a different code for
|
||||
# built-in vs module just in case we want that down the road.
|
||||
# back that with a /sys/modules. We also check
|
||||
# /sys/bus/pci/drivers/ as neither lsmod nor /sys/modules might
|
||||
# contain needed info (like in Fedora-like OS).
|
||||
function check_for_driver {
|
||||
$(lsmod | grep $1 > /dev/null)
|
||||
if [ $? -eq 0 ]; then
|
||||
if lsmod | grep -q ${1//-/_}; then
|
||||
return 1
|
||||
else
|
||||
if [[ -d /sys/module/$1 ]]; then
|
||||
return 2
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -d /sys/module/${1} || \
|
||||
-d /sys/module/${1//-/_} || \
|
||||
-d /sys/bus/pci/drivers/${1} || \
|
||||
-d /sys/bus/pci/drivers/${1//-/_} ]]; then
|
||||
return 2
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user