Use prompt for sudo, not needed for doas

This commit is contained in:
Anthony Cornehl 2019-09-10 13:23:04 -07:00 committed by Brian May
parent 71f2248b07
commit a765aa3235

View File

@ -185,12 +185,6 @@ class MultiListener:
class FirewallClient: class FirewallClient:
def __init__(self, method_name, sudo_pythonpath): def __init__(self, method_name, sudo_pythonpath):
# Default to sudo unless on OpenBSD in which case use built in `doas`
elevbin = 'sudo'
if platform.platform().startswith('OpenBSD'):
elevbin = 'doas'
self.auto_nets = [] self.auto_nets = []
python_path = os.path.dirname(os.path.dirname(__file__)) python_path = os.path.dirname(os.path.dirname(__file__))
argvbase = ([sys.executable, sys.argv[0]] + argvbase = ([sys.executable, sys.argv[0]] +
@ -199,9 +193,11 @@ class FirewallClient:
['--firewall']) ['--firewall'])
if ssyslog._p: if ssyslog._p:
argvbase += ['--syslog'] argvbase += ['--syslog']
elev_prefix = [part % {'eb': elevbin} # Default to sudo unless on OpenBSD in which case use built in `doas`
for part in ['%(eb)s', '-p', if platform.platform().startswith('OpenBSD'):
'[local %(eb)s] Password: ']] elev_prefix = ['doas']
else:
elev_prefix = ['sudo', '-p', '[local %(eb)s] Password: ']
if sudo_pythonpath: if sudo_pythonpath:
elev_prefix += ['/usr/bin/env', elev_prefix += ['/usr/bin/env',
'PYTHONPATH=%s' % python_path] 'PYTHONPATH=%s' % python_path]