From: Martin Mares Date: Sat, 4 Jan 2003 12:27:51 +0000 (+0000) Subject: Added update-pciids. X-Git-Tag: v3.0.0~173 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=1b95f396a4673d4abe69c42292561021d233937f;p=pciutils.git Added update-pciids. --- diff --git a/ChangeLog b/ChangeLog index 90ab39e..e5fb9e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2003-01-04 Martin Mares - * Releasing as 2.1.11. + * Released as 2.1.11. + + * Added the update-ids utility. * lib: Removed partially implemented "syscall" access method which will probably never be needed. diff --git a/Makefile b/Makefile index 49931c6..c0d639a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.48 2003/01/04 11:33:25 mj Exp $ +# $Id: Makefile,v 1.49 2003/01/04 12:27:51 mj Exp $ # Makefile for Linux PCI Utilities # (c) 1998--2003 Martin Mares @@ -39,7 +39,7 @@ DISTTMP=/tmp/pciutils-dist export -all: lib lspci setpci lspci.8 setpci.8 pci.ids +all: lib lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids lib: lib/config.h $(MAKE) -C lib all @@ -54,6 +54,9 @@ lspci.o: lspci.c pciutils.h setpci.o: setpci.c pciutils.h common.o: common.c pciutils.h +update-pciids: update-pciids.sh + sed <$< >$@ "s@^DEST=.*@DEST=$(PREFIX)/share/pci.ids@" + %.8: %.man M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)$(SUFFIX)/" @@ -66,12 +69,13 @@ install: all # -c is ignored on Linux, but required on FreeBSD $(DIRINSTALL) -m 755 $(ROOT)/sbin $(PREFIX)/share $(MANDIR)/man8 $(INSTALL) -c -m 755 -s lspci setpci $(ROOT)/sbin + $(INSTALL) -c -m 755 -s update-pciids $(PREFIX)/sbin if [ ! -f $(PREFIX)/share/pci.ids -o pci.ids -nt $(PREFIX)/share/pci.ids ] ; then \ $(INSTALL) -c -m 644 pci.ids $(PREFIX)/share ; \ elif [ -f $(PREFIX)/share/pci.ids ] ; then \ echo "$(PREFIX)/share/pci.ids is same or newer than the version to be installed, skipping." ; \ fi - $(INSTALL) -c -m 644 lspci.8 setpci.8 $(MANDIR)/man8 + $(INSTALL) -c -m 644 lspci.8 setpci.8 update-pciids.8 $(MANDIR)/man8 # Remove relics from old versions rm -f $(ROOT)/etc/pci.ids @@ -80,16 +84,11 @@ uninstall: all rm -f $(PREFIX)/share/pci.ids rm -f $(PREFIX)/man/man8/lspci.8 $(PREFIX)/man/man8/setpci.8 -update-ids: - if [ -f pci.ids.orig ] ; then mv pci.ids pci.ids.orig ; fi - wget http://pciids.sf.net/pci.ids.bz2 - bzip2 -d pci.ids.bz2 - get-ids: cp ~/tree/pciids/pci.ids pci.ids pci.ids: - @ [ -f pci.ids ] || echo >&2 "The pci.ids file is no longer part of the CVS. Please do make update-ids to download them." && false + @ [ -f pci.ids ] || echo >&2 "The pci.ids file is no longer part of the CVS. Please do run update-ids.sh to download them." && false release: sed "s/^\\(Version:[ ]*\\)[0-9.]*/\\1$(VERSION)/;s/^\\(Entered-date:[ ]*\\)[0-9]*/\\1`date -d$(DATE) '+%y%m%d'`/;s/\\(pciutils-\\)[0-9.]*/\\1$(VERSION)\\./" pciutils.lsm.new diff --git a/README b/README index 379e095..7a8b411 100644 --- a/README +++ b/README @@ -26,6 +26,8 @@ The utilities include: (See manual pages for more details) CAUTION: There is a couple of dangerous points and caveats, please read the manual page first! + - update-pciids: download the current version of the pci.ids file. + 2. Compiling and (un)installing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -46,8 +48,7 @@ than I release new versions of this package. If you are missing names for any of your devices or you just want to stay on the bleeding edge, download the most recent pci.ids file from -http://pciids.sf.net/. You can try "make update-ids" to accomplish that -automatically (requires wget and bzip2). +http://pciids.sf.net/ (e.g., by running the update-ids utility). If your devices still appear as unknown, please send us their ID's and names, the detailed instructions for submissions are listed on the diff --git a/lspci.man b/lspci.man index 6719277..6ac75c7 100644 --- a/lspci.man +++ b/lspci.man @@ -146,7 +146,7 @@ kernels. Contains per-bus subdirectories with per-card config space files and a file containing a list of all PCI devices. .SH SEE ALSO -.BR setpci (8) +.BR setpci (8), update-pciids (8) .SH AUTHOR The Linux PCI Utilities are maintained by Martin Mares . diff --git a/update-pciids.man b/update-pciids.man new file mode 100644 index 0000000..bba92fb --- /dev/null +++ b/update-pciids.man @@ -0,0 +1,27 @@ +.TH update-pciids 8 "@TODAY@" "@VERSION@" "Linux PCI Utilities" +.IX update-pciids + +.SH NAME +update-pciids \- download new version of the PCI ID list + +.SH SYNOPSIS +.B update-pciids + +.SH DESCRIPTION +.B update-pciids +fetches the current version of the pci.ids file from the primary distribution +site and installs it. + +This utility requires either wget or lynx to be installed. If gzip or bzip2 +are available, it automatically downloads the compressed version of the list. + +.SH FILES +.TP +.B /usr/share/pci.ids +Here we install the new list. + +.SH SEE ALSO +.BR lspci (8), setpci (8) + +.SH AUTHOR +The Linux PCI Utilities are maintained by Martin Mares . diff --git a/update-pciids.sh b/update-pciids.sh new file mode 100755 index 0000000..d3c0b1f --- /dev/null +++ b/update-pciids.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +set -e +SRC="http://pciids.sourceforge.net/pci.ids" +DEST=pci.ids + +if which bzip2 >/dev/null ; then + DECOMP="bzip2 -d" + SRC="$SRC.bz2" +elif which gzip >/dev/null ; then + DECOMP="gzip -d" + SRC="$SRC.gz" +else + DECOMP="cat" +fi + +if which wget >/dev/null ; then + DL="wget -O $DEST.new $SRC" +elif which lynx >/dev/null ; then + DL="eval lynx -source $SRC >$DEST.new" +else + echo >&2 "update-pciids: cannot find wget nor lynx" + exit 1 +fi + +if ! $DL ; then + echo >&2 "update-pciids: download failed" + rm -f $DEST.new + exit 1 +fi + +if ! $DECOMP <$DEST.new >$DEST.neww ; then + echo >&2 "update-pciids: decompression failed, probably truncated file" + exit 1 +fi + +if ! grep >/dev/null "^C " $DEST.neww ; then + echo >&2 "update-pciids: missing class info, probably truncated file" + exit 1 +fi + +if [ -f $DEST ] ; then + mv $DEST $DEST.old +fi +mv $DEST.neww $DEST +rm $DEST.new + +echo "Done."