George Hung | 961e0f5 | 2020-05-13 17:25:22 +0800 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host" |
| 4 | BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/os" |
| 5 | BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status" |
| 6 | BOOT_Property="OperatingSystemState" |
| 7 | |
| 8 | LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager" |
| 9 | LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive" |
| 10 | LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby" |
| 11 | LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group" |
| 12 | LED_Property="Asserted" |
| 13 | |
| 14 | dbus_state=0 |
| 15 | boot_status="" |
| 16 | check_flag=0 |
| 17 | |
| 18 | mapper wait $LED_INACTIVE_OBJPATH |
| 19 | mapper wait $LED_STANDBY_OBJPATH |
| 20 | while true; do |
| 21 | boot_status=$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}') |
| 22 | |
| 23 | if [ $boot_status != "\"Standby\"" ] && [ $check_flag -eq 0 ];then |
| 24 | busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true |
| 25 | check_flag=1 |
| 26 | elif [ $boot_status == "\"Standby\"" ];then |
| 27 | busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false |
| 28 | busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true |
| 29 | break |
| 30 | fi |
| 31 | sleep 1 |
| 32 | done |
| 33 | |
| 34 | exit 0 |