blob: 6d4e6ba1e8b2823641f86d857767e15182dd1456 [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
6# $1: The OF_FULLNAME udev attribute for the MAX31785
7
8base="/etc/default/obmc/hwmon/"$1
9target=$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
25instance=$(systemd-escape $1)
26systemctl start xyz.openbmc_project.Hwmon@$instance.service