2017-01-22 17:22:34 +00:00
|
|
|
#! @BUILD_SHEBANG@
|
2013-10-26 12:35:35 +00:00
|
|
|
|
|
|
|
# create a randome file
|
2015-01-30 17:31:20 +00:00
|
|
|
file="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
2013-10-26 12:35:35 +00:00
|
|
|
cat >$file <<EOF
|
|
|
|
hello world!
|
|
|
|
EOF
|
|
|
|
|
2013-11-07 01:41:09 +00:00
|
|
|
. "@builddir@/grub-core/modinfo.sh"
|
|
|
|
|
|
|
|
if [ x"${grub_modinfo_platform}" = xemu ]; then
|
|
|
|
grub_file="(host)$file"
|
|
|
|
else
|
|
|
|
grub_file="/boot/grub/file"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2015-01-30 17:31:20 +00:00
|
|
|
outfile1="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
2013-10-26 12:35:35 +00:00
|
|
|
@builddir@/grub-shell --files=/boot/grub/file=$file >$outfile1 <<EOF
|
2013-11-07 01:41:09 +00:00
|
|
|
sha512sum $grub_file
|
2013-10-26 12:35:35 +00:00
|
|
|
EOF
|
|
|
|
|
2015-01-30 17:31:20 +00:00
|
|
|
outfile2="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
2013-10-26 12:35:35 +00:00
|
|
|
sha512sum $file >$outfile2
|
|
|
|
|
|
|
|
SHA1=`cat $outfile1 | tr -d '\n' | cut -f1 -d\ `
|
|
|
|
SHA2=`cat $outfile2 | cut -f1 -d\ `
|
|
|
|
|
|
|
|
if test "$SHA1" = "$SHA2"; then
|
|
|
|
rm -f ${outfile1} ${outfile2}
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo "GRUB sha512sum output did not match sha512sum output."
|
|
|
|
echo "See diff -u ${outfile1} ${outfile2}"
|
|
|
|
exit 1
|
|
|
|
fi
|