Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Link in the correct MAX31785 phosphor-hwmon config file to use based on the |
| 4 | # WaterCooled property, and then start the hwmon service. |
| 5 | |
| 6 | # $1: The OF_FULLNAME udev attribute for the MAX31785 |
| 7 | |
| 8 | base="/etc/default/obmc/hwmon/"$1 |
| 9 | target=$base".conf" |
| 10 | |
| 11 | service=$(mapper get-service /xyz/openbmc_project/inventory/system/chassis) |
| 12 | |
| 13 | if [ $(busctl get-property $service \ |
| 14 | /xyz/openbmc_project/inventory/system/chassis \ |
| 15 | xyz.openbmc_project.Inventory.Decorator.CoolingType \ |
| 16 | WaterCooled | grep true | wc -l) != 0 ]; |
| 17 | then |
| 18 | source=$base'_water.conf' |
| 19 | else |
| 20 | source=$base'_air.conf' |
| 21 | fi |
| 22 | |
| 23 | ln -sf $source $target |
| 24 | |
| 25 | instance=$(systemd-escape $1) |
| 26 | systemctl start xyz.openbmc_project.Hwmon@$instance.service |