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