Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx #!/bin/sh
     5         kx 
     5         kx [ "$1" = "-q" ] && quiet=true || quiet=false
     5         kx 
     5         kx set -e
     5         kx SRC="https://pci-ids.ucw.cz/v2.2/pci.ids"
     5         kx DEST=pci.ids
     5         kx PCI_COMPRESSED_IDS=0
     5         kx GREP=grep
     5         kx 
     5         kx # if pci.ids is read-only (because the filesystem is read-only),
     5         kx # then just skip this whole process.
     5         kx if ! touch ${DEST} >/dev/null 2>&1 ; then
     5         kx 	${quiet} || echo "${DEST} is read-only, exiting." 1>&2
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx if [ "$PCI_COMPRESSED_IDS" = 1 ] ; then
     5         kx 	DECOMP="cat"
     5         kx 	SRC="$SRC.gz"
     5         kx 	GREP=zgrep
     5         kx elif which bzip2 >/dev/null 2>&1 ; then
     5         kx 	DECOMP="bzip2 -d"
     5         kx 	SRC="$SRC.bz2"
     5         kx elif which gzip >/dev/null 2>&1 ; then
     5         kx 	DECOMP="gzip -d"
     5         kx 	SRC="$SRC.gz"
     5         kx else
     5         kx 	DECOMP="cat"
     5         kx fi
     5         kx 
     5         kx if which curl >/dev/null 2>&1 ; then
     5         kx 	DL="curl -o $DEST.new $SRC"
     5         kx     ${quiet} && DL="$DL -s -S"
     5         kx elif which wget >/dev/null 2>&1 ; then
     5         kx 	DL="wget --no-timestamping -O $DEST.new $SRC"
     5         kx 	${quiet} && DL="$DL -q"
     5         kx elif which lynx >/dev/null 2>&1 ; then
     5         kx 	DL="eval lynx -source $SRC >$DEST.new"
     5         kx else
     5         kx 	echo >&2 "update-pciids: cannot find curl, wget or lynx"
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx if ! $DL ; then
     5         kx 	echo >&2 "update-pciids: download failed"
     5         kx 	rm -f $DEST.new
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx if ! $DECOMP <$DEST.new >$DEST.neww ; then
     5         kx 	echo >&2 "update-pciids: decompression failed, probably truncated file"
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx if ! $GREP >/dev/null "^C " $DEST.neww ; then
     5         kx 	echo >&2 "update-pciids: missing class info, probably truncated file"
     5         kx 	exit 1
     5         kx fi
     5         kx 
     5         kx if [ -f $DEST ] ; then
     5         kx 	mv $DEST $DEST.old
     5         kx 	# --reference is supported only by chmod from GNU file, so let's ignore any errors
     5         kx 	chmod -f --reference=$DEST.old $DEST.neww 2>/dev/null || true
     5         kx fi
     5         kx mv $DEST.neww $DEST
     5         kx rm $DEST.new
     5         kx 
     5         kx # Older versions did not compress the ids file, so let's make sure we
     5         kx # clean that up.
     5         kx if [ ${DEST%.gz} != ${DEST} ] ; then
     5         kx 	rm -f ${DEST%.gz} ${DEST%.gz}.old
     5         kx fi
     5         kx 
     5         kx ${quiet} || echo "Done."