1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-22 14:07: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:
Dan O'Reilly
2009-04-11 18:53:30 -04:00
parent 0aaba8c439
commit 0a007d0f44
3 changed files with 9 additions and 5 deletions

View File

@@ -131,8 +131,8 @@ class Interface(BaseInterface):
def CheckWirelessTools(self): def CheckWirelessTools(self):
""" Check for the existence needed wireless tools """ """ Check for the existence needed wireless tools """
# We don't need any external apps so just return if not WPACTRL_AVAIL:
pass BaseInterface.CheckWirelessTools(self)
@neediface("") @neediface("")
def GetIP(self, ifconfig=""): def GetIP(self, ifconfig=""):

View File

@@ -57,7 +57,9 @@ def setup_dbus(force=True):
except DBusException: except DBusException:
if force: if force:
print "Can't connect to the daemon, trying to start it automatically..." 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: try:
dbusmanager.connect_to_dbus() dbusmanager.connect_to_dbus()
except DBusException: except DBusException:

View File

@@ -155,6 +155,8 @@ def PromptToStartDaemon():
""" Prompt the user to start the daemon """ """ Prompt the user to start the daemon """
daemonloc = wpath.sbin + 'wicd' daemonloc = wpath.sbin + 'wicd'
sudo_prog = choose_sudo_prog() sudo_prog = choose_sudo_prog()
if not sudo_prog:
return False
if "gksu" in sudo_prog or "ktsuss" in sudo_prog: if "gksu" in sudo_prog or "ktsuss" in sudo_prog:
msg = '--message' msg = '--message'
else: else:
@@ -163,6 +165,7 @@ def PromptToStartDaemon():
'Wicd needs to access your computer\'s network cards.', 'Wicd needs to access your computer\'s network cards.',
daemonloc] daemonloc]
os.spawnvpe(os.P_WAIT, sudo_prog, sudo_args, os.environ) os.spawnvpe(os.P_WAIT, sudo_prog, sudo_args, os.environ)
return True
def RunRegex(regex, string): def RunRegex(regex, string):
""" runs a regex search on a string """ """ runs a regex search on a string """
@@ -453,8 +456,7 @@ def choose_sudo_prog(prog_num=0):
for path in paths: for path in paths:
if os.path.exists(path): if os.path.exists(path):
return path return path
return ""
return None
def find_path(cmd): def find_path(cmd):
""" Try to find a full path for a given file name. """ Try to find a full path for a given file name.