George Hung | 85d9f2a | 2020-05-20 17:22:25 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | sigfile="/tmp/bmc.sig" |
| 4 | imagebmc="/run/initramfs/image-bmc" |
| 5 | bmcimage="/run/initramfs/bmc-image" |
| 6 | publickey="/etc/activationdata/OpenBMC/publickey" |
| 7 | bmclog="/tmp/update-bmc.log" |
| 8 | |
| 9 | if [ -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 |
| 19 | else |
| 20 | echo "No $publickey file" > $bmclog |
| 21 | exit 1 |
| 22 | fi |