mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2026-01-06 19:50:11 +01:00
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:
@@ -53,8 +53,8 @@ def setcap():
|
|||||||
path = helper_path()
|
path = helper_path()
|
||||||
if is_set():
|
if is_set():
|
||||||
return True
|
return True
|
||||||
p = subprocess.run(["setcap", "cap_net_raw,cap_net_admin+eip", path], \
|
p = subprocess.run(["sudo", "setcap", "cap_net_raw,cap_net_admin+eip", \
|
||||||
capture_output=True)
|
path], capture_output=True)
|
||||||
if p.returncode !=0:
|
if p.returncode !=0:
|
||||||
logger.error(f"Failed to set capability to {path}")
|
logger.error(f"Failed to set capability to {path}")
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user