blob: bbaf15d7dcb1670a9dc3f8681658c7a7aefd2969 [file] [log] [blame]
George Hung85d9f2a2020-05-20 17:22:25 +08001#!/bin/sh
2
3sigfile="/tmp/bmc.sig"
4imagebmc="/run/initramfs/image-bmc"
5bmcimage="/run/initramfs/bmc-image"
6publickey="/etc/activationdata/OpenBMC/publickey"
7bmclog="/tmp/update-bmc.log"
8
9if [ -f $publickey ];then
10 r="$(openssl dgst -verify $publickey -sha256 -signature $sigfile $bmcimage)"
11 echo "$r" > $bmclog
12 if [[ "Verified OK" == "$r" ]]; then
13 mv $bmcimage $imagebmc
14 rm -f $sigfile
15 exit 0
16 else
17 exit 1
18 fi
19else
20 echo "No $publickey file" > $bmclog
21 exit 1
22fi