2023-02-08 21:01:48 +00:00
|
|
|
#!/bin/bash
|
2017-03-27 22:03:29 +00:00
|
|
|
# get a file and extend a TPM PCR
|
2023-02-18 17:58:43 +00:00
|
|
|
. /etc/functions
|
2017-03-27 22:03:29 +00:00
|
|
|
|
|
|
|
die() {
|
2023-02-20 16:01:17 +00:00
|
|
|
TRACE "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"`"
|
2022-08-25 18:43:31 +00:00
|
|
|
tpmr extend -ix "$INDEX" -if "$FILE" || die "$FILE: tpm extend failed"
|
2017-03-27 22:03:29 +00:00
|
|
|
|
|
|
|
|