3 # see also update-pciids.sh (fancier)
5 [ "$1" = "-q" ] && quiet="true" || quiet="false"
8 SRC="http://www.linux-usb.org/usb.ids"
11 # if usb.ids is read-only (because the filesystem is read-only),
12 # then just skip this whole process.
13 if ! touch ${DEST} >&2 >/dev/null ; then
14 ${quiet} || echo "${DEST} is read-only, exiting."
18 if which wget >/dev/null 2>&1 ; then
19 DL="wget -O $DEST.new $SRC"
20 ${quiet} && DL="$DL -q"
21 elif which lynx >/dev/null 2>&1 ; then
22 DL="eval lynx -source $SRC >$DEST.new"
24 echo >&2 "update-usbids: cannot find wget nor lynx"
29 echo >&2 "update-usbids: download failed"
34 if ! grep >/dev/null "^C " $DEST.new ; then
35 echo >&2 "update-usbids: missing class info, probably truncated file"
39 if [ -f $DEST ] ; then
41 # --reference is supported only by chmod from GNU file, so let's ignore any errors
42 chmod -f --reference=$DEST.old $DEST.new 2>/dev/null || true
46 ${quiet} || echo "Done."