blob: 3da25e483d39b878b32cf611abb56c5c8d33b4c9 [file] [log] [blame]
George Hung85d9f2a2020-05-20 17:22:25 +08001#!/bin/sh
2
3# Copyright (c) 2019-present Lenovo
4# Copyright (c) 2020 Quanta Computer Inc.
5# Licensed under BSD-3, see COPYING.BSD file for details.
6
7IMAGE_FILE="/tmp/bios-image"
8SIG_FILE="/tmp/bmc.sig"
9BURN_IMAGE="/tmp/image-bios"
10sha256_image="FFFF"
11sha256_file="EEEE"
12
13echo "Verify bios image..."
14
15if [ -e $IMAGE_FILE ] && [ -e $SIG_FILE ];
16then
17 sha256_image=`sha256sum "$IMAGE_FILE" | awk '{print $1}'`
18 sha256_file=`awk '{print $1}' $SIG_FILE`
19fi
20
21if [[ $sha256_image != $sha256_file ]];
22then
23 echo "bios image verify fail."
24 rm -f $IMAGE_FILE
25 echo "Remove bios image"
26 exit 1
27else
28 echo "bios image verify ok."
29 mv $IMAGE_FILE $BURN_IMAGE
30 rm -f $SIG_FILE
31 exit 0
32fi