bluepy_helper_cap.py: Add sudo to setcap command

When a python package is installed by user, the commands in the package
can not run with sudo. To run setcap in bluepy_helper_cap.py with sudo
privilege, specify sudo command within the python script.

Signed-off-by: Shin'ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
This commit is contained in:
Shin'ichiro Kawasaki
2020-10-10 17:30:03 +09:00
parent 86ed7ebf91
commit 54c3a18e5e

View File

@@ -53,8 +53,8 @@ def setcap():
path = helper_path()
if is_set():
return True
p = subprocess.run(["setcap", "cap_net_raw,cap_net_admin+eip", path], \
capture_output=True)
p = subprocess.run(["sudo", "setcap", "cap_net_raw,cap_net_admin+eip", \
path], capture_output=True)
if p.returncode !=0:
logger.error(f"Failed to set capability to {path}")
return False