]>
git.ipfire.org Git - thirdparty/pciutils.git/blob - update-pciids.sh
3 [ "$1" = "-q" ] && quiet
=true || quiet
=false
6 SRC
="http://pci-ids.ucw.cz/v2.2/pci.ids"
11 # if pci.ids is read-only (because the filesystem is read-only),
12 # then just skip this whole process.
13 if ! touch ${DEST} >/dev
/null
2>&1 ; then
14 ${quiet} ||
echo "${DEST} is read-only, exiting." 1>&2
18 if [ "$PCI_COMPRESSED_IDS" = 1 ] ; then
22 elif which bzip2 >/dev
/null
2>&1 ; then
25 elif which gzip >/dev
/null
2>&1 ; then
32 if which curl
>/dev
/null
2>&1 ; then
33 DL
="curl -o $DEST.new $SRC"
34 ${quiet} && DL
="$DL -s -S"
35 elif which wget
>/dev
/null
2>&1 ; then
36 DL
="wget --no-timestamping -O $DEST.new $SRC"
37 ${quiet} && DL
="$DL -q"
38 elif which lynx
>/dev
/null
2>&1 ; then
39 DL
="eval lynx -source $SRC >$DEST.new"
41 echo >&2 "update-pciids: cannot find curl, wget or lynx"
46 echo >&2 "update-pciids: download failed"
51 if ! $DECOMP <$DEST.new
>$DEST.neww
; then
52 echo >&2 "update-pciids: decompression failed, probably truncated file"
56 if ! $GREP >/dev
/null
"^C " $DEST.neww
; then
57 echo >&2 "update-pciids: missing class info, probably truncated file"
61 if [ -f $DEST ] ; then
63 # --reference is supported only by chmod from GNU file, so let's ignore any errors
64 chmod -f --reference=$DEST.old
$DEST.neww
2>/dev
/null || true
69 # Older versions did not compress the ids file, so let's make sure we
71 if [ ${DEST%.gz} != ${DEST} ] ; then
72 rm -f ${DEST%.gz} ${DEST%.gz}.old
75 ${quiet} ||
echo "Done."