blob: 2e346d0fb380d14833a5a878dab5d051221f989c [file] [log] [blame]
Joel Stanley1c7e17d2017-09-05 17:44:33 +10001#!/bin/bash
2
3action=$1
4devpath=$2
5of_fullname=$3
6
7#Use of_fullname if it's there, otherwise use devpath.
8
9path=$of_fullname
10if [ -z "$path" ]
11then
12 path=$devpath
13
14 if [[ "$path" =~ (.*)/hwmon/hwmon[0-9]+$ ]];
15 then
16 path=${BASH_REMATCH[1]}
17 fi
18fi
19
William A. Kennington IIIc7c0fcc12019-12-09 17:52:08 -080020# Needed to re-do escaping used to avoid bitbake separator conflicts
Lei YU58238eb2018-12-14 14:33:55 +080021path="${path//:/--}"
William A. Kennington IIIc7c0fcc12019-12-09 17:52:08 -080022# Needed to escape prior to being used as a unit argument
23path="$(systemd-escape "$path")"
24systemctl --no-block "$action" "xyz.openbmc_project.Hwmon@$path.service"