Commit 019108da authored by Seth Forshee's avatar Seth Forshee
Browse files

UBUNTU: Add script to identify candidate firmware for lts backport updates



Add debian/list-lts-update-files, which compares two branches
of the git repository and lists firmware files present in the
second branch but not in the first. A fwinfo file from the
backport kernel can also be supplied, which will be used to
further filter the list of files to only those present in fwinfo.
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
parent fc36df30
#!/bin/bash
#
# Used to get a list of firmware files needed to update a LTS
# linux-firmware package for a backport kernel. For example to
# get a list of files for trusty to support the linux-lts-xenial
# kernel run:
#
# debian/list-lts-update-files trusty xenial /path/to/xenial/fwinfo
#
# This will generate a list of files that satisfy all of these
# conditions:
#
# 1) In the xenial branch of linux-firmware
# 2) Not in the trusty branch of linux-firmware
# 3) In the specified fwinfo file
#
# This can be used as a starting point for finding upstream
# commits needed to add the missing firmware files.
#
# The fwinfo file can be omitted, in which case the output is a list
# of firmware files in @newbranch but not in @oldbranch.
if [ $# -lt 2 ]; then
echo "Usage $0 <oldbranch> <newbranch> [<fwinfo>]"
exit 1
fi
OLDBRANCH="$1"
NEWBRANCH="$2"
FWINFO="$3"
TMPDIR=$(mktemp -d)
function cleanup {
rm -r "$TMPDIR"
}
trap cleanup EXIT
if ! git ls-tree -r --name-only "$OLDBRANCH" >"$TMPDIR/files.tmp"
then
exit 1
fi
cat "$TMPDIR/files.tmp" | sort >"$TMPDIR/oldbranch-files"
if ! git ls-tree -r --name-only "$NEWBRANCH" >"$TMPDIR/files.tmp"
then
exit 1
fi
cat "$TMPDIR/files.tmp" | sort >"$TMPDIR/newbranch-files"
# Get files in @newbranch not in @oldbranch
comm -13 "$TMPDIR/oldbranch-files" "$TMPDIR/newbranch-files" >"$TMPDIR/new-files"
if [ "$3" == "" ]; then
cat "$TMPDIR/new-files"
exit 0
fi
if ! cat $FWINFO | head -n1 | grep "firmware: " > /dev/null
then
echo "Invliad fwinfo file $FWINFO"
exit 1
fi
cat "$FWINFO" | sed 's/firmware: \+//' | sort >"$TMPDIR/fwinfo-files"
comm -12 "$TMPDIR/new-files" "$TMPDIR/fwinfo-files"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment