2
0

check-usb-ids.sh 613 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. set -euo pipefail
  3. IFS=$'\n\t'
  4. if [[ "${NO_DOCKER:-0}" == 1 ]]; then
  5. echo "SKIP: usb ids because of disabled docker test"
  6. exit 0
  7. fi
  8. tmpdir=`mktemp -d`
  9. echo "Listing usb devices:"
  10. sudo podman run -t --privileged --rm=true \
  11. -v `pwd`/usb.ids:/usr/share/hwdata/usb.ids:ro \
  12. -v "$tmpdir:/mnt/out" \
  13. vcrhonek/hwdata-check \
  14. /bin/bash -c 'lsusb 2>/mnt/out/err.out; python3 /usr/share/doc/python3-hwdata/example.py 2>>/mnt/out/err.out' || :
  15. if [[ `cat $tmpdir/err.out | wc -l` -gt 0 ]]; then
  16. echo "ERRORS:"
  17. nl $tmpdir/err.out
  18. rm -rf $tmpdir
  19. exit 1
  20. fi
  21. rm -rf $tmpdir