blob: 9759b880cc653beaf2426e3ee865edfd59e45c4d [file] [log] [blame]
Thang Q. Nguyend57a5fb2022-02-18 05:57:04 +00001#!/bin/bash
2
3# Check current Host status. Do nothing when the Host is currently ON
4st=$(busctl get-property xyz.openbmc_project.State.Host \
5 /xyz/openbmc_project/state/host0 xyz.openbmc_project.State.Host \
6 CurrentHostState | cut -d"." -f6)
7if [ "$st" == "Running\"" ]; then
8 exit 0
9fi
10
11# Time out checking for Host ON is 60s
12cnt=60
13while [ "$cnt" -gt 0 ];
14do
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. Nguyend57a5fb2022-02-18 05:57:04 +000021 exit 0
22 fi
23 sleep 1
24done
25
26exit 1