Makefile: added check for usb.ids
authorMichal Minar <miminar@redhat.com>
Wed, 18 Feb 2015 09:04:01 +0000 (10:04 +0100)
committerMichal Minar <miminar@redhat.com>
Wed, 25 Feb 2015 07:59:18 +0000 (08:59 +0100)
Try to list usb devices with lsusb from inside of priviliged docker
container. The check will be run only if /run/docker.sock is available.

Signed-off-by: Michal Minar <miminar@redhat.com>
Makefile

index 5286732305f976321103f9c86c81c9d9c2d97979..ebe3a3439fb4d26c67d8ef497646be92cdb6ead5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -59,6 +59,18 @@ changelog:
 check:
        @[ -x /sbin/lspci ] && /sbin/lspci -i pci.ids > /dev/null || { echo "FAILURE: /sbin/lspci -i pci.ids"; exit 1; } && echo "OK: /sbin/lspci -i pci.ids"
        @./check-pci-ids.py || { echo "FAILURE: ./check-pci-ids.py"; exit 1; } && echo "OK: ./check-pci-ids.py"
+       @if [[ -e /run/docker.sock ]]; then \
+           tmpdir=`mktemp -d`; \
+           echo "Listing usb devices:"; \
+           docker run -t --privileged --rm=true \
+               -v `pwd`/usb.ids:/usr/share/hwdata/usb.ids:r \
+               -v "$$tmpdir:/mnt/out" \
+               miminar/hwdata-check /bin/bash -c 'lsusb 2>/mnt/out/err.out'; \
+           if [[ `cat $$tmpdir/err.out | wc -l` -gt 0 ]]; then \
+               echo "ERRORS:"; nl $$tmpdir/err.out; rm -rf $$tmpdir; exit 1; \
+           fi; \
+           rm -rf $$tmpdir; \
+       fi
        @echo -n "CHECK date of pci.ids: "; grep "Date:" pci.ids | cut -d ' ' -f 5
        @echo -n "CHECK date of usb.ids: "; grep "Date:" usb.ids | cut -d ' ' -f 6
        @: videodrivers is tab-separated