mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-06-26 10:23:10 -04:00
exec.py: add elevation_noop() to refresh sudo timestamp and query for password
This commit is contained in:
parent
c562271006
commit
72ca2258d1
1 changed files with 5 additions and 1 deletions
6
exec.py
6
exec.py
|
@ -79,7 +79,7 @@ def run_cmd(
|
|||
stdout: Optional[int] = None,
|
||||
switch_user: Optional[str] = None,
|
||||
elevation_method: Optional[ElevationMethod] = None,
|
||||
) -> Union[int, subprocess.CompletedProcess]:
|
||||
) -> Union[subprocess.CompletedProcess, int]:
|
||||
"execute `script` as `switch_user`, elevating and su'ing as necessary"
|
||||
kwargs: dict = {}
|
||||
env_cmd = []
|
||||
|
@ -106,3 +106,7 @@ def run_cmd(
|
|||
def run_root_cmd(*kargs, **kwargs):
|
||||
kwargs['switch_user'] = 'root'
|
||||
return run_cmd(*kargs, **kwargs)
|
||||
|
||||
|
||||
def elevation_noop(**kwargs):
|
||||
run_root_cmd('/bin/true', **kwargs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue