diff --git a/check_xbps.py b/check_xbps.py index b59c9d0..c408afc 100755 --- a/check_xbps.py +++ b/check_xbps.py @@ -79,9 +79,9 @@ lxc-2.0.4_1 update x86_64 https://repo.voidlinux.eu/current 1837102 468024'''.sp ############################################################################## -def run_command(cmdline): +def run_command(cmdline, needs_sudo=False): tstart = time.time() - if plugin.options.sudo: + if needs_sudo and plugin.options.sudo: new = ['sudo', '-n', '--'] new.extend(cmdline) cmdline = new @@ -112,7 +112,7 @@ def run_command(cmdline): if plugin.options.sync_repo_index: plugin.verbose(1, '-S/--sync_repo_index given') cmdline = [plugin.options.xbps_install, '-S',] - (sout, serr, rc) = run_command(cmdline) + (sout, serr, rc) = run_command(cmdline, needs_sudo=True) sout and plugin.verbose(3, sout, prefix='stdout: ') serr and plugin.verbose(3, serr, prefix='stderr: ') plugin.verbose(2, 'Return code: %d' % rc)