Anton D. Kachalov | 5b520cf | 2021-02-03 23:19:39 +0100 | [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 | # Needed to re-do escaping used to avoid bitbake separator conflicts |
| 21 | path="${path//:/--}" |
| 22 | # Needed to escape prior to being used as a unit argument |
| 23 | path="$(systemd-escape "$path")" |
| 24 | systemctl --no-block "$action" "xyz.openbmc_project.Hwmon@$path.service" |