summaryrefslogtreecommitdiffstats
path: root/meta-openbmc-machines/meta-openpower/meta-ibm/meta-witherspoon/recipes-phosphor/sensors/phosphor-hwmon%/start_max31785_hwmon.sh
blob: 6d4e6ba1e8b2823641f86d857767e15182dd1456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

# Copy in the correct MAX31785 phosphor-hwmon config file to use based on the
# WaterCooled property, and then start the hwmon service.

# $1: The OF_FULLNAME udev attribute for the MAX31785

base="/etc/default/obmc/hwmon/"$1
target=$base".conf"

service=$(mapper get-service /xyz/openbmc_project/inventory/system/chassis)

if [ $(busctl get-property $service \
     /xyz/openbmc_project/inventory/system/chassis \
     xyz.openbmc_project.Inventory.Decorator.CoolingType \
     WaterCooled | grep true | wc -l) != 0 ];
then
    source=$base'_water.conf'
else
    source=$base'_air.conf'
fi

cp $source $target

instance=$(systemd-escape $1)
systemctl start xyz.openbmc_project.Hwmon@$instance.service
OpenPOWER on IntegriCloud