mirror of
https://github.com/gryf/wicd.git
synced 2025-12-22 22:27:59 +01:00
Only check for wireless tools in the ioctl backend if wpactrl isn't available.
Fix up error handling when there is no graphical sudo program installed.
This commit is contained in:
@@ -131,8 +131,8 @@ class Interface(BaseInterface):
|
||||
|
||||
def CheckWirelessTools(self):
|
||||
""" Check for the existence needed wireless tools """
|
||||
# We don't need any external apps so just return
|
||||
pass
|
||||
if not WPACTRL_AVAIL:
|
||||
BaseInterface.CheckWirelessTools(self)
|
||||
|
||||
@neediface("")
|
||||
def GetIP(self, ifconfig=""):
|
||||
|
||||
@@ -57,7 +57,9 @@ def setup_dbus(force=True):
|
||||
except DBusException:
|
||||
if force:
|
||||
print "Can't connect to the daemon, trying to start it automatically..."
|
||||
misc.PromptToStartDaemon()
|
||||
if not misc.PromptToStartDaemon():
|
||||
print "Failed to find a graphical sudo program, cannot continue."
|
||||
return False
|
||||
try:
|
||||
dbusmanager.connect_to_dbus()
|
||||
except DBusException:
|
||||
|
||||
@@ -155,6 +155,8 @@ def PromptToStartDaemon():
|
||||
""" Prompt the user to start the daemon """
|
||||
daemonloc = wpath.sbin + 'wicd'
|
||||
sudo_prog = choose_sudo_prog()
|
||||
if not sudo_prog:
|
||||
return False
|
||||
if "gksu" in sudo_prog or "ktsuss" in sudo_prog:
|
||||
msg = '--message'
|
||||
else:
|
||||
@@ -163,6 +165,7 @@ def PromptToStartDaemon():
|
||||
'Wicd needs to access your computer\'s network cards.',
|
||||
daemonloc]
|
||||
os.spawnvpe(os.P_WAIT, sudo_prog, sudo_args, os.environ)
|
||||
return True
|
||||
|
||||
def RunRegex(regex, string):
|
||||
""" runs a regex search on a string """
|
||||
@@ -453,8 +456,7 @@ def choose_sudo_prog(prog_num=0):
|
||||
for path in paths:
|
||||
if os.path.exists(path):
|
||||
return path
|
||||
|
||||
return None
|
||||
return ""
|
||||
|
||||
def find_path(cmd):
|
||||
""" Try to find a full path for a given file name.
|
||||
|
||||
Reference in New Issue
Block a user