Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Matt Spinler | 540b9ba | 2018-05-07 11:31:57 -0500 | [diff] [blame] | 3 | # Copy in the correct MAX31785 phosphor-hwmon config file to use based on the |
Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 4 | # WaterCooled property, and then start the hwmon service. |
| 5 | |
Matthew Barth | 2790b22 | 2018-12-14 15:57:46 -0600 | [diff] [blame] | 6 | # $1: The escaped OF_FULLNAME udev attribute for the MAX31785 |
Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 7 | |
Matthew Barth | 2790b22 | 2018-12-14 15:57:46 -0600 | [diff] [blame] | 8 | base="/etc/default/obmc/hwmon/"$(systemd-escape -u "$1") |
Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 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 | |
Matt Spinler | 540b9ba | 2018-05-07 11:31:57 -0500 | [diff] [blame] | 23 | cp $source $target |
Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 24 | |
Matthew Barth | 2790b22 | 2018-12-14 15:57:46 -0600 | [diff] [blame] | 25 | instance='-'$1 |
Matt Spinler | 0066e31 | 2018-04-25 10:53:41 -0500 | [diff] [blame] | 26 | systemctl start xyz.openbmc_project.Hwmon@$instance.service |