Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (5) </ 1 2 [3] 4 5 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Update pci-utils and pci.ids< Next Oldest | Next Newest >
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Nov. 22 2007,18:23 QUOTE

OK, I'll do that.

In the meantime, the "update-pciids" script looks like this:
Code Sample
#!/bin/sh

set -e
SRC="http://pciids.sourceforge.net/v2.2/pci.ids"
DEST=/opt/pci-utils/share/pci.ids
PCI_COMPRESSED_IDS=
GREP=grep

if [ -n "$PCI_COMPRESSED_IDS" ]; then
DECOMP="cat"
SRC="$SRC.gz"
GREP=zgrep
elif 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 curl >/dev/null; then
DL="curl -o $DEST.new $SRC"
elif 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 curl, wget or 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
# --reference is supported only by chmod from GNU file, so let's ignore any errors
chmod -f --reference=$DEST.old $DEST.neww 2>/dev/null || true
fi
mv $DEST.neww $DEST
rm $DEST.new

echo "Done."

pci.ids=487K, pci.ids.gz=137k, pci.ids.bz2=126k (current dsl=154k) but dsl lspci=23.7k and this lspci=63.6k (stripped)

Setting PCI_COMPRESSED_IDS=1 downloads pci.ids.gz but gives the following error:
Quote
/opt/pci-utils/sbin/update-pciids: line 45: zgrep: command not found
update-pciids: missing class info, probably truncated file

I guess dsl is missing zgrep?
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Nov. 23 2007,02:03 QUOTE

So what you gain in size you lose by requiring extra binary.

Also, for the slowest machines, uncompressing that which was not before is just an extra burden. Especially for bzip2. Bzip2 has been rejected in the past over the slower machine issue.

Perhaps best to update but without compressing.
Back to top
Profile PM WEB 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Nov. 23 2007,04:39 QUOTE

Ok. I took a look at this and have modified the update-pciids script to work with DSL, i.e., not use zgrep. Seems to be working fine and still being compressed just using gzip -d.

Thanks for the suggestion.


Edited by roberts on Nov. 23 2007,04:42
Back to top
Profile PM WEB 
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Nov. 23 2007,05:18 QUOTE

If you could let me know how you modified the script I'll test lspci (from pciutils-2.29) out to be sure it works with dsl
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Nov. 23 2007,05:30 QUOTE

Modded the first if statement to:

Code Sample

if [ -n "$PCI_COMPRESSED_IDS" ] && [ -x zgrep ]; then
       DECOMP="cat"
       SRC="$SRC.gz"
       GREP=zgrep
#elif 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
Back to top
Profile PM WEB 
20 replies since Nov. 18 2007,14:32 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (5) </ 1 2 [3] 4 5 >/
reply to topic new topic new poll
Quick Reply: Update pci-utils and pci.ids

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code