X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=update-pciids.sh;h=607502ad45a51a033cc336eac5ca538e2af91202;hb=90d270fa720862ee357735b494a0b58643a27061;hp=1fa604e1bf782cf7bc96bbbecdd1a6f13730f158;hpb=b6e558fb75b6e46b9a10d2b1e5c10c346b412331;p=pciutils.git diff --git a/update-pciids.sh b/update-pciids.sh index 1fa604e..607502a 100755 --- a/update-pciids.sh +++ b/update-pciids.sh @@ -6,6 +6,9 @@ SRC="https://pci-ids.ucw.cz/v2.2/pci.ids" DEST=pci.ids PCI_COMPRESSED_IDS= GREP=grep +VERSION=unknown +USER_AGENT=update-pciids/$VERSION +QUIET= [ "$1" = "-q" ] && quiet=true || quiet=false @@ -30,19 +33,28 @@ else fi if command -v curl >/dev/null 2>&1 ; then - DL="curl -o $DEST.new $SRC" - ${quiet} && DL="$DL -s -S" + ${quiet} && QUIET="-s -S" + dl () + { + curl -o $DEST.new --user-agent "$USER_AGENT curl" $QUIET $SRC + } elif command -v wget >/dev/null 2>&1 ; then - DL="wget --no-timestamping -O $DEST.new $SRC" - ${quiet} && DL="$DL -q" + ${quiet} && QUIET="-q" + dl () + { + wget --no-timestamping -O $DEST.new --user-agent "$USER_AGENT wget" $QUIET $SRC + } elif command -v lynx >/dev/null 2>&1 ; then - DL="eval lynx -source $SRC >$DEST.new" + dl () + { + lynx -source -useragent="$USER_AGENT lynx" $SRC >$DEST.new + } else echo >&2 "update-pciids: cannot find curl, wget or lynx" exit 1 fi -if ! $DL ; then +if ! dl ; then echo >&2 "update-pciids: download failed" rm -f $DEST.new exit 1