Joel Stanley | 7b29e20 | 2017-09-05 17:44:33 +1000 | [diff] [blame] | 1 | #!/bin/bash |
2 | |||||
3 | action=$1 | ||||
4 | devpath=$2 | ||||
5 | of_fullname=$3 | ||||
6 | |||||
7 | #Use of_fullname if it's there, otherwise use devpath. | ||||
8 | |||||
9 | path=$of_fullname | ||||
10 | if [ -z "$path" ] | ||||
11 | then | ||||
12 | path=$devpath | ||||
13 | |||||
14 | if [[ "$path" =~ (.*)/hwmon/hwmon[0-9]+$ ]]; | ||||
15 | then | ||||
16 | path=${BASH_REMATCH[1]} | ||||
17 | fi | ||||
18 | fi | ||||
19 | |||||
20 | path="${path//:/--}" | ||||
21 | |||||
22 | systemctl $action 'xyz.openbmc_project.Hwmon@'$path'.service' |