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 | |
William A. Kennington III | e1acbce | 2019-12-09 17:52:08 -0800 | [diff] [blame] | 20 | # Needed to re-do escaping used to avoid bitbake separator conflicts |
Lei YU | b9f0f68 | 2018-12-14 14:33:55 +0800 | [diff] [blame] | 21 | path="${path//:/--}" |
William A. Kennington III | e1acbce | 2019-12-09 17:52:08 -0800 | [diff] [blame] | 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" |