Thang Q. Nguyen | d57a5fb | 2022-02-18 05:57:04 +0000 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Check current Host status. Do nothing when the Host is currently ON |
| 4 | st=$(busctl get-property xyz.openbmc_project.State.Host \ |
| 5 | /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \ |
| 6 | CurrentHostState | cut -d"." -f6) |
| 7 | if [ "$st" == "Running\"" ]; then |
| 8 | exit 0 |
| 9 | fi |
| 10 | |
| 11 | # Time out checking for Host ON is 60s |
| 12 | cnt=60 |
| 13 | while [ "$cnt" -gt 0 ]; |
| 14 | do |
| 15 | cnt=$((cnt - 1)) |
| 16 | st=$(busctl call xyz.openbmc_project.State.HostCondition.Gpio \ |
| 17 | /xyz/openbmc_project/Gpios/host0 org.freedesktop.DBus.Properties \ |
| 18 | Get ss xyz.openbmc_project.Condition.HostFirmware \ |
| 19 | CurrentFirmwareCondition | cut -d"." -f6) |
| 20 | if [ "$st" == "Running\"" ]; then |
Thang Q. Nguyen | d57a5fb | 2022-02-18 05:57:04 +0000 | [diff] [blame] | 21 | exit 0 |
| 22 | fi |
| 23 | sleep 1 |
| 24 | done |
| 25 | |
| 26 | exit 1 |