From ed53597afeaf40c55aca7ef81aaf55cde9086f0e Mon Sep 17 00:00:00 2001 From: Steve McIntyre <93sam@debian.org> Date: Fri, 10 Jun 2011 13:33:56 +0000 Subject: [PATCH] copy latest make-firmware-image script from trunk --- squeeze/debian/changelog | 4 +++ squeeze/tools/make-firmware-image | 57 +++++++++---------------------- 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/squeeze/debian/changelog b/squeeze/debian/changelog index 0e897c5e..ef7fb9a0 100644 --- a/squeeze/debian/changelog +++ b/squeeze/debian/changelog @@ -31,6 +31,10 @@ debian-cd (3.1.6) UNRELEASED-backport; urgency=low to try and put that on i386 image sets before linux-image-amd64. Closes: #622622 * New version of tools/grab_md5 to cope with new Packages.gz files layout + * tools/make-firmware-image: Rather than use the firmware task which + gets out of date, look for firmware/microcode files directly in the + Packages file. Check for things installing in /lib/firmware, and add + those packages. -- Raphaƫl Hertzog Fri, 04 Feb 2011 09:59:21 +0100 diff --git a/squeeze/tools/make-firmware-image b/squeeze/tools/make-firmware-image index 6a5fb552..951b06aa 100755 --- a/squeeze/tools/make-firmware-image +++ b/squeeze/tools/make-firmware-image @@ -1,62 +1,39 @@ #!/bin/sh +# Work out which firmware files to include in the image +# Several steps: +# +# 1. Look for packages which contain "firmware" or "microcode" in their package names +# 2. Check each of those packages to see if they contain files in /lib/firmware +# 3. For those that do, add them into the firmware temp tree +# 4. Make images (tar.gz, zip) of that tree + set -e MIRROR=$1 SUITE=$2 TMPDIR=$3 -BASEDIR=$4 export LC_ALL=C if [ "$MIRROR"x = ""x ] || \ [ "$SUITE"x = ""x ] || \ - [ "$TMPDIR"x = ""x ] || \ - [ "$BASEDIR"x = ""x ] ; then + [ "$TMPDIR"x = ""x ] ; then echo "$0: Need parameters" exit 1 fi -TASKFILE=$BASEDIR/tasks/firmware - rm -rf $TMPDIR/firmware mkdir -p $TMPDIR/firmware -FILES=`( cpp -undef $TASKFILE | grep -v -e "^#" -e "^$" ; \ - echo DONE ; - zcat $MIRROR/dists/$SUITE/non-free/binary-*/Packages.gz ) | \ - awk ' - /DONE/ { - in_packages = 1 - matched = 0 - next - } - /.*/ { - if (!in_packages) { - firmware[$1] = num_fw - num_fw++ - next - } - } - /^Package: / { - matched = 0 - if (in_packages) { - for (fw in firmware) { - if (fw == $2) { - matched = 1 - } - } - next - } - } - /^Filename: / { - if (matched) { - print $2 - } - }' | sort -u` +FILES=`zcat ${MIRROR}/dists/${SUITE}/*/binary-*/Packages.gz | \ + grep-dctrl -Pe '.*(firmware|microcode).*' -s Filename | sort -u | awk '{print $2}'` -for file in $FILES; do - cp $MIRROR/$file $TMPDIR/firmware/ -done +for FILE in $FILES; do + # Don't use "grep -q" here, it causes errors from tar + if (dpkg --contents ${MIRROR}/${FILE} | grep " ./lib/firmware/" >/dev/null) ; then + cp ${MIRROR}/${FILE} $TMPDIR/firmware + fi +done cd $TMPDIR/firmware tar czf ../firmware.tar.gz .