]> git.proxmox.com Git - grub2.git/blame - tests/test_sha512sum.in
Release 2.06-13+deb12u1
[grub2.git] / tests / test_sha512sum.in
CommitLineData
a827807a 1#! @BUILD_SHEBANG@
7994a09a
BC
2
3# create a randome file
f153fcb5 4file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
7994a09a
BC
5cat >$file <<EOF
6hello world!
7EOF
8
87a04a2d
VS
9. "@builddir@/grub-core/modinfo.sh"
10
11if [ x"${grub_modinfo_platform}" = xemu ]; then
12 grub_file="(host)$file"
13else
14 grub_file="/boot/grub/file"
15fi
16
17
f153fcb5 18outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
7994a09a 19@builddir@/grub-shell --files=/boot/grub/file=$file >$outfile1 <<EOF
87a04a2d 20sha512sum $grub_file
7994a09a
BC
21EOF
22
f153fcb5 23outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
7994a09a
BC
24sha512sum $file >$outfile2
25
26SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ `
27SHA2=`cat $outfile2 | cut -f1 -d\ `
28
29if test "$SHA1" = "$SHA2"; then
30 rm -f ${outfile1} ${outfile2}
31 exit 0
32else
33 echo "GRUB sha512sum output did not match sha512sum output."
34 echo "See diff -u ${outfile1} ${outfile2}"
35 exit 1
36fi