#!/bin/sh
#
# Generate a json file to go in the the fwupd-signed template
# package. Describes exactly what needs to be signed, and how.

DIR=$1
SOURCE=$2
ARCH=$3
OUT="$DIR/files.json"

# What file are we looking to sign?
BINARY=$(find debian/tmp -name '*.efi' | xargs basename)

# Actually needs full path within the binary deb
BINARY="usr/lib/${SOURCE}/efi/${BINARY}"

rm -f $OUT

printf '{"%s": {\n' "${SOURCE}" >> $OUT
printf '  "files": [ \n' >> $OUT
printf '    {"sig_type": "efi", "file": "%s"}\n' "${BINARY}" >> $OUT
printf '  ]\n' >> $OUT
printf '} }\n' >> $OUT

