copy latest make-firmware-image script from trunk
This commit is contained in:
parent
405a26e480
commit
fb6320d0c4
|
@ -1,61 +1,38 @@
|
||||||
#!/bin/sh
|
#!/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
|
set -e
|
||||||
|
|
||||||
MIRROR=$1
|
MIRROR=$1
|
||||||
SUITE=$2
|
SUITE=$2
|
||||||
TMPDIR=$3
|
TMPDIR=$3
|
||||||
BASEDIR=$4
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
if [ "$MIRROR"x = ""x ] || \
|
if [ "$MIRROR"x = ""x ] || \
|
||||||
[ "$SUITE"x = ""x ] || \
|
[ "$SUITE"x = ""x ] || \
|
||||||
[ "$TMPDIR"x = ""x ] || \
|
[ "$TMPDIR"x = ""x ] ; then
|
||||||
[ "$BASEDIR"x = ""x ] ; then
|
|
||||||
echo "$0: Need parameters"
|
echo "$0: Need parameters"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TASKFILE=$BASEDIR/tasks/firmware
|
|
||||||
|
|
||||||
rm -rf $TMPDIR/firmware
|
rm -rf $TMPDIR/firmware
|
||||||
mkdir -p $TMPDIR/firmware
|
mkdir -p $TMPDIR/firmware
|
||||||
|
|
||||||
FILES=`( cpp $TASKFILE | grep -v -e "^#" -e "^$" ; \
|
FILES=`zcat ${MIRROR}/dists/${SUITE}/*/binary-*/Packages.gz | \
|
||||||
echo DONE ;
|
grep-dctrl -Pe '.*(firmware|microcode).*' -s Filename | sort -u | awk '{print $2}'`
|
||||||
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`
|
|
||||||
|
|
||||||
for file in $FILES; do
|
for FILE in $FILES; do
|
||||||
cp $MIRROR/$file $TMPDIR/firmware/
|
# 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
|
done
|
||||||
|
|
||||||
cd $TMPDIR/firmware
|
cd $TMPDIR/firmware
|
||||||
|
|
Loading…
Reference in New Issue