mirror of
https://github.com/kawasaki/pyscrlink.git
synced 2025-07-21 09:31:21 +02: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()
|
||||
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
|
||||
|
Reference in New Issue
Block a user