~martijnbraam/almobootstrap

1d0eb2792fa0a808f0a5f4d47b61d8d48967630f — Luca Weiss 8 months ago c6a8a26
pmb.helpers.run: fix sudo timer

The recent changes to the sudo code forgot this usage here which broke
with the sudo timer config option enabled.

Fixes: d31313f7 ("Don't use 'sudo' when running as root")
Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230605092217.725218-1-luca@z3ntu.xyz%3E
1 files changed, 2 insertions(+), 2 deletions(-)

M pmb/helpers/run_core.py
M pmb/helpers/run_core.py => pmb/helpers/run_core.py +2 -2
@@ 227,10 227,10 @@ def sudo_timer_iterate():
    Run sudo -v and schedule a new timer to repeat the same.
    """

    if pmb.config.sudo == "sudo":
    if pmb.config.which_sudo() == "sudo":
        subprocess.Popen(["sudo", "-v"]).wait()
    else:
        subprocess.Popen([pmb.config.sudo, "true"]).wait()
        subprocess.Popen(pmb.config.sudo("true")).wait()

    timer = threading.Timer(interval=60, function=sudo_timer_iterate)
    timer.daemon = True