Public bug reported:

Binary package hint: usbutils

http://www.linux-usb.org/usb.ids returns usb.ids as a gzip file - which
the update-usbids.sh cannot handle using grep.

the following revised script will successfully download the usb.ids
file:

#!/bin/sh

# see also update-pciids.sh (fancier)

[ "$1" = "-q" ] && quiet="true" || quiet="false"

set -e
SRC="http://www.linux-usb.org/usb.ids";
DEST=/var/lib/misc/usb.ids

# if usb.ids is read-only (because the filesystem is read-only),
# then just skip this whole process.
if ! touch ${DEST} >&2 >/dev/null ; then
        ${quiet} || echo "${DEST} is read-only, exiting."
        exit 0
fi

if which wget >/dev/null 2>&1 ; then
        DL="wget -O $DEST.new.gz $SRC"
        ${quiet} && DL="$DL -q"
elif which lynx >/dev/null 2>&1 ; then
        DL="eval lynx -source $SRC >$DEST.new.gz"
else
        echo >&2 "update-usbids: cannot find wget nor lynx"
        exit 1
fi

if ! $DL ; then
        echo >&2 "update-usbids: download failed"
        rm -f $DEST.new
        exit 1
fi

gunzip $DEST.new.gz

if ! grep >/dev/null "^C " $DEST.new ; then
        echo >&2 "update-usbids: missing class info, probably truncated file"
        exit 1
fi

if [ -f $DEST ] ; then
        mv $DEST $DEST.old
        # --reference is supported only by chmod from GNU file, so let's ignore 
any errors
        chmod -f --reference=$DEST.old $DEST.new 2>/dev/null || true
fi
mv $DEST.new $DEST

${quiet} || echo "Done."

ProblemType: Bug
Architecture: amd64
Date: Wed Feb 17 23:10:03 2010
DistroRelease: Ubuntu 9.10
NonfreeKernelModules: fglrx
Package: usbutils 0.82-0ubuntu1 [modified: usr/sbin/update-usbids.sh 
var/lib/misc/usb.ids]
ProcEnviron:
 LANGUAGE=
 LANG=en_NZ.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.31-19.56-generic
SourcePackage: usbutils
Uname: Linux 2.6.31-19-generic x86_64
XsessionErrors:
 (firefox:10801): GLib-WARNING **: g_set_prgname() called multiple times
 (polkit-gnome-authentication-agent-1:10809): GLib-CRITICAL **: 
g_once_init_leave: assertion `initialization_value != 0' failed
 (firefox:10846): GLib-WARNING **: g_set_prgname() called multiple times

** Affects: usbutils (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug

-- 
/usr/sbin/update-usbids.sh doesn't handle gzip usb.ids file from 
http://www.linux-usb.org/usb.ids
https://bugs.launchpad.net/bugs/523116
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to