blob: 5eff17450ce3d89686ef58baddaac3ce65a8649b [file] [log] [blame]
Matt Spinler245cb962018-04-25 10:53:41 -05001#!/bin/sh
2
Matt Spinler0d1a95d2018-05-07 11:31:57 -05003# Copy in the correct MAX31785 phosphor-hwmon config file to use based on the
Matt Spinler245cb962018-04-25 10:53:41 -05004# WaterCooled property, and then start the hwmon service.
5
Matthew Barthe520df42018-12-14 15:57:46 -06006# $1: The escaped OF_FULLNAME udev attribute for the MAX31785
Matt Spinler245cb962018-04-25 10:53:41 -05007
Matthew Barthe520df42018-12-14 15:57:46 -06008base="/etc/default/obmc/hwmon/"$(systemd-escape -u "$1")
Matt Spinler245cb962018-04-25 10:53:41 -05009target=$base".conf"
10
11service=$(mapper get-service /xyz/openbmc_project/inventory/system/chassis)
12
13if [ $(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 ];
17then
18 source=$base'_water.conf'
19else
20 source=$base'_air.conf'
21fi
22
Matt Spinler0d1a95d2018-05-07 11:31:57 -050023cp $source $target
Matt Spinler245cb962018-04-25 10:53:41 -050024
Matthew Barthe520df42018-12-14 15:57:46 -060025instance='-'$1
Matt Spinler245cb962018-04-25 10:53:41 -050026systemctl start xyz.openbmc_project.Hwmon@$instance.service