- Updated pci, usb and vendor ids.
[oweals/hwdata.git] / check-usb-ids.sh
1 #!/bin/bash
2
3 set -euo pipefail
4 IFS=$'\n\t'
5
6 if [[ "${NO_DOCKER:-0}" == 1 ]]; then
7     echo "SKIP: usb ids because of disabled docker test"
8     exit 0
9 fi
10
11 if ! [[ -e /run/docker.sock ]]; then
12     echo "Skipping check of usb ids because of missing docker socket."
13     exit 0
14 fi
15
16 tmpdir=`mktemp -d`
17 echo "Listing usb devices:"
18 sudo docker run -t --privileged --rm=true \
19     -v `pwd`/usb.ids:/usr/share/hwdata/usb.ids:ro \
20     -v "$tmpdir:/mnt/out" \
21     vcrhonek/hwdata-check \
22     /bin/bash -c 'lsusb 2>/mnt/out/err.out; python /usr/share/doc/python-hwdata/example.py 2>>/mnt/out/err.out' || :
23 if [[ `cat $tmpdir/err.out | wc -l` -gt 0 ]]; then
24     echo "ERRORS:"
25     nl $tmpdir/err.out
26     rm -rf $tmpdir
27     exit 1
28 fi
29 rm -rf $tmpdir