File: check-usb-ids.sh

package info (click to toggle)
hwdata 0.394-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,948 kB
  • sloc: makefile: 196; python: 171; sh: 111
file content (24 lines) | stat: -rwxr-xr-x 613 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/bash

set -euo pipefail
IFS=$'\n\t'

if [[ "${NO_DOCKER:-0}" == 1 ]]; then
    echo "SKIP: usb ids because of disabled docker test"
    exit 0
fi

tmpdir=`mktemp -d`
echo "Listing usb devices:"
sudo podman run -t --privileged --rm=true \
    -v `pwd`/usb.ids:/usr/share/hwdata/usb.ids:ro \
    -v "$tmpdir:/mnt/out" \
    vcrhonek/hwdata-check \
    /bin/bash -c 'lsusb 2>/mnt/out/err.out; python3 /usr/share/doc/python3-hwdata/example.py 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