File: test_sha512sum.in

package info (click to toggle)
grub2 2.02~beta2-22
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 54,604 kB
  • ctags: 64,764
  • sloc: ansic: 370,672; asm: 16,177; sh: 12,946; cpp: 1,993; python: 1,438; makefile: 1,357; lex: 393; sed: 271; yacc: 268; lisp: 50; awk: 48; perl: 31
file content (36 lines) | stat: -rw-r--r-- 695 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/bash

# create a randome file
file=`mktemp`
cat >$file <<EOF
hello world!
EOF

. "@builddir@/grub-core/modinfo.sh"

if [ x"${grub_modinfo_platform}" = xemu ]; then
    grub_file="(host)$file"
else
    grub_file="/boot/grub/file"
fi


outfile1=`mktemp`
@builddir@/grub-shell --files=/boot/grub/file=$file >$outfile1 <<EOF
sha512sum $grub_file
EOF

outfile2=`mktemp`
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