blob: 66beb9f7c12cf7342a11b91a6fef3e76e7a1b6c7 [file]
#!/bin/bash
# On non-ttf BMC, host needs to be up to perform any recovery action remotely.
# Therefore, retry the BIOS update via power cycle to try to recover it.
retry_bios_update(){
active_version="${1}"
# State:
# Check the BIOS status to see if it is ACTIVATED.
# the state will only be ACTIVATED after a powercycle when the expected BIOS update failed.
local state="$(flashupdate info --config bios --stage_state --clean_output)"
if [[ "${state}" == "ACTIVATED" ]]; then
staged_version="$(flashupdate info --config bios --staged_version --clean_output)"
# Trigger powercycle if staged/activated vesrion is mismatched.
[[ "${active_version}" == "${staged_version}" ]] || \
systemctl start gbmc-psu-hardreset.target
fi
}