]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - debian/scripts/misc/get-firmware
UBUNTU: [Packaging] resync git-ubuntu-log
[mirror_ubuntu-bionic-kernel.git] / debian / scripts / misc / get-firmware
CommitLineData
0d34a427
LO
1#!/bin/bash
2#
3# Find all files in linux-firmware that are new or different since the previous release
4# and copy them into the kernel firmware directory. You should only do this on the
5# backport branch since it would be redundant on the released kernel. It assumed you've
6# unpacked linux-firmware from each release into separate directories.
7#
8# Example: $0 ~/ubuntu/linux-firmware-precise ~/ubuntu/linux-firmware-quantal
9
10if [ "$1" = "" ] || [ "$2" = "" ] || [ ! -f $1/WHENCE ] || [ ! -f $2/WHENCE ]
11then
12 echo You must supply 2 firmware directories.
13 exit 1
14fi
15
16if [ ! -f debian/debian.env ]
17then
18 echo You must run this script from the root of the repo
19 exit 1
20fi
21. debian/debian.env
22
23NFWINFO="`find $DEBIAN -name fwinfo|wc -l`"
24if [ ! "$NFWINFO" = "1" ]
25then
26 echo Your repo is hosed. There can only be one fwinfo file.
27 find $DEBIAN -name fwinfo
28 exit 1
29fi
30
31FWINFO="`pwd`/`find $DEBIAN -name fwinfo`"
32
33CDIR=`pwd`
34OFW=$1
35NFW=$2
36
37cd $NFW
38#
39# Find all files in $NFW that are new or different from $1
40#
41(find . -type f | egrep -v "debian|git|LICEN|WHEN|READ|Make|configure" | sed 's;\./;;' | \
42while read f
43do
44 if grep -q $f $FWINFO
45 then
46 if [ ! -f $OFW/$f ]
47 then
48 echo $f
49 elif ! cmp $f $OFW/$f > /dev/null
50 then
51 echo $f
52 fi
53 fi
54done) |\
55while read f
56do
57 mkdir -p $CDIR/firmware/`dirname $f`
58 if [ ! -f $CDIR/firmware/`dirname $f`/`basename $f`.ihex ]
59 then
60 cp -v $f $CDIR/firmware/`dirname $f`
61 fi
62done