2003-01-04 Martin Mares <mj@ucw.cz>
- * 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.
-# $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 <mj@ucw.cz>
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
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)/"
# -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
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 >pciutils.lsm.new
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
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 <mj@ucw.cz>.
--- /dev/null
+.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 <mj@ucw.cz>.
--- /dev/null
+#!/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."