blob: d45105dbece83eaa387c6c19a6a43269c1177ab6 [file] [log] [blame]
George Hungf089ba12020-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
Patrick Williams8c226232023-04-15 20:05:21 -050012 if [ "Verified OK" = "$r" ]; then
George Hungf089ba12020-05-20 17:22:25 +080013 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