| #!/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 |
| } |