Use doas instead of sudo if installed (MR 2091)

Prefer using doas over sudo if both are installed. Let the user override
the sudo tool with PMB_SUDO.
This commit is contained in:
Anjandev Momi 2021-08-08 23:14:39 -04:00 committed by Oliver Smith
parent 2801b5d687
commit c1407f921b
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
8 changed files with 60 additions and 8 deletions

View file

@ -224,7 +224,10 @@ def sudo_timer_iterate():
Run sudo -v and schedule a new timer to repeat the same.
"""
subprocess.Popen(["sudo", "-v"]).wait()
if pmb.config.sudo == "sudo":
subprocess.Popen(["sudo", "-v"]).wait()
else:
subprocess.Popen([pmb.config.sudo, "true"]).wait()
timer = threading.Timer(interval=60, function=sudo_timer_iterate)
timer.daemon = True