summaryrefslogtreecommitdiff
path: root/debian/generate_dbx_list
blob: 95ec3e9e7c7ad0f04bc00cf04ca8571f3b4d1761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
#
# Helper script - generate a DBX file for inclusion into a shim build
#
# Takes an input file (e.g. debian-dbx.hashes) with data in the form
#
# <hex-encoded sha256 checksums> <arch>
#
# and generates a siglist of the hashes for just the architecture we
# want. No point including all the hashes for all the arches, it just
# bloats things and slows things down.

set -e

ARCH=$1
IN=$2
OUT=$3

rm -f $OUT
for HASH in $(grep -E "[[:xdigit:]]{32} $ARCH" < $IN | \
		  awk '{print $1}' | sort | uniq); do
    echo "  Adding $HASH to dbx list"
    efisiglist -o $OUT -a -h $HASH
done

# If we have an empty hashes file, create an empty DBX file
touch $OUT