heads/initrd/bin/wget-measure.sh

25 lines
377 B
Bash
Raw Normal View History

2017-03-27 22:03:29 +00:00
#!/bin/sh
# get a file and extend a TPM PCR
. /etc/functions
2017-03-27 22:03:29 +00:00
die() {
DEBUG "Under /bin/wget-measure.sh:die"
2017-03-27 22:03:29 +00:00
echo >&2 "$@"
exit 1
}
INDEX="$1"
URL="$2"
if [ -z "$INDEX" -o -z "$URL" ]; then
die "Usage: $0 pcr-index url"
fi
wget "$URL" || die "$URL: failed"
FILE="`basename "$URL"`"
tpm extend -ix "$INDEX" -if "$FILE" || die "$FILE: tpm extend failed"