[packages] usbutils: Create gziped list when updating IDs, bump release number
[openwrt/svn-archive/archive.git] / utils / usbutils / patches / 110-gzip-update-usbids.patch
1 --- a/update-usbids.sh.in
2 +++ b/update-usbids.sh.in
3 @@ -6,9 +6,9 @@
4
5 set -e
6 SRC="http://www.linux-usb.org/usb.ids"
7 -DEST=usb.ids
8 +DEST=usb.ids.gz
9
10 -# if usb.ids is read-only (because the filesystem is read-only),
11 +# if usb.ids.gz 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."
15 @@ -16,10 +16,10 @@ if ! touch ${DEST} >&2 >/dev/null ; then
16 fi
17
18 if which wget >/dev/null 2>&1 ; then
19 - DL="wget -O $DEST.new $SRC"
20 + DL="eval wget -O- $SRC | gzip >$DEST.new"
21 ${quiet} && DL="$DL -q"
22 elif which lynx >/dev/null 2>&1 ; then
23 - DL="eval lynx -source $SRC >$DEST.new"
24 + DL="eval lynx -source $SRC | gzip >$DEST.new"
25 else
26 echo >&2 "update-usbids: cannot find wget nor lynx"
27 exit 1
28 @@ -31,7 +31,7 @@ if ! $DL ; then
29 exit 1
30 fi
31
32 -if ! grep >/dev/null "^C " $DEST.new ; then
33 +if ! zcat $DEST.new | grep >/dev/null "^C " ; then
34 echo >&2 "update-usbids: missing class info, probably truncated file"
35 exit 1
36 fi