tpm2_key_protector: Enable build for powerpc_ieee1275
[grub.git] / tests / test_sha512sum.in
blobb2bd89609cd3175da6bdba0d0aa5bcb6d7442c6f
1 #! @BUILD_SHEBANG@
2 set -e
4 # create a randome file
5 file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
6 cat >$file <<EOF
7 hello world!
8 EOF
10 . "@builddir@/grub-core/modinfo.sh"
12 if [ x"${grub_modinfo_platform}" = xemu ]; then
13     grub_file="(host)$file"
14 else
15     grub_file="/boot/grub/file"
19 outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
20 @builddir@/grub-shell --files=/boot/grub/file=$file >$outfile1 <<EOF
21 sha512sum $grub_file
22 EOF
24 outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 99
25 sha512sum $file >$outfile2
27 SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ `
28 SHA2=`cat $outfile2 | cut -f1 -d\ `
30 if test "$SHA1" = "$SHA2"; then
31     rm -f ${outfile1} ${outfile2}
32     exit 0
33 else
34     echo "GRUB sha512sum output did not match sha512sum output."
35     echo "See diff -u ${outfile1} ${outfile2}"
36     exit 1