On Wed, 2017-08-09 at 12:50 +0200, Hannes Reinecke wrote:
> +requires() {
> + if modinfo scsi_debug | grep -q inq_vendor ; then
> + return 0
> + fi
> + return 1
> +}
How about changing the above four statements into the following, which is
shorter and more robust?
modinfo scsi_debug | grep -q '^parm:[[:blank:]]*inq_vendor:'
> + modprobe scsi_debug inq_vendor="$vendor" inq_product="$model"
> + host=$(lsscsi -H | sed -n 's/.\([0-9]*\).*scsi_debug/\1/p')
Not all systems have lsscsi. How about using
/sys/bus/pseudo/drivers/scsi_debug/adapter0/host*
instead?
> + rmmod scsi_debug
Please check the rmmod return value to catch unload failures due to a
user space process having opened the SCSI device created by scsi_debug.
Thanks,
Bart.