Last active
September 15, 2017 19:10
-
-
Save charleshofer/e753f88deff0c75eda196eb24877fa0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
BMC_IP=$1 | |
BMC_IMAGE=$2 | |
FORCE=$3 | |
# Check that the user has a correct image | |
if [[ "$BMC_IMAGE" != *".ubi.mtd" ]]; then | |
echo "Image file should end in .ubi.mtd"; | |
exit 1 | |
fi | |
# Verify MAC address is programmed | |
MAC=`sshpass -p "0penBmc" ssh "root@$BMC_IP" busctl get-property xyz.openbmc_project.Inventory.Manager /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet xyz.openbmc_project.Inventory.Item.NetworkInterface MACAddress` | |
if [[ "$MAC" == *"00:00:00:00:00:00"* ]]; then | |
if [[ "$FORCE" == "force" ]]; then | |
echo "BMC MAC address was not set. Forcing code update..." | |
else | |
echo "BMC MAC address must be set."; | |
exit 1 | |
fi | |
fi | |
# Copy the file build/tmp/deploy/images/witherspoon/obmc-phosphor-image-witherspoon.ubi.mtd to /run/initramfs/image-bmc and image-alt | |
sshpass -p 0penBmc scp "$BMC_IMAGE" "root@$BMC_IP:/run/initramfs/image-bmc" | |
sshpass -p 0penBmc scp "$BMC_IMAGE" "root@$BMC_IP:/run/initramfs/image-alt" | |
# Reboot | |
sshpass -p 0penBmc ssh "root@$BMC_IP" /sbin/reboot | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment