1
0
mirror of https://github.com/gryf/wicd.git synced 2026-01-07 14:24:22 +01:00

Use the -v option if dhclient is 4.x

Simplify sorting method for WAPs.
This commit is contained in:
Dan O'Reilly
2009-04-19 21:13:58 -04:00
parent 242b740a9a
commit 2f14b3d5f0
2 changed files with 15 additions and 16 deletions

View File

@@ -116,7 +116,9 @@ def expand_script_macros(script, msg, bssid, essid):
script -- the script to execute.
msg -- the name of the script, %{script} will be expanded to this.
bssid -- the bssid of the network we connect to, defaults to 'wired'.
essid -- the essid of the network we connect to, defaults to 'wired'."""
essid -- the essid of the network we connect to, defaults to 'wired'.
"""
def repl(match):
macro = match.group(1).lower()
if macro_dict.has_key(macro):
@@ -564,23 +566,13 @@ class Wireless(Controller):
"""
def comp(x, y):
if x.has_key('quality'):
if x['quality'] > y['quality']:
return 1
elif x['quality'] < y['quality']:
return -1
else:
return 0
if 'quality' in x:
key = 'quality'
else:
if x['strength'] < y['strength']:
return 1
elif x['strength'] > y['strength']:
return -1
else:
return 0
key = 'strength'
return cmp(x[key], y[key])
if not self.wiface: return []
wiface = self.wiface
# Prepare the interface for scanning
@@ -771,6 +763,7 @@ class Wireless(Controller):
""" Sets the wpa_supplicant driver associated with the interface. """
self.wiface.SetWpaDriver(driver)
class WirelessConnectThread(ConnectThread):
""" A thread class to perform the connection to a wireless network.
@@ -1063,4 +1056,3 @@ class WiredConnectThread(ConnectThread):
self.connect_result = "Success"
self.is_connecting = False

View File

@@ -220,6 +220,8 @@ class BaseInterface(object):
if self.dhclient_cmd and cl in [misc.DHCLIENT, misc.AUTO]:
client = "dhclient"
cmd = self.dhclient_cmd
if self.dhclient_needs_verbose:
cmd += ' -v'
elif self.dhcpcd_cmd and cl in [misc.DHCPCD, misc.AUTO]:
client = "dhcpcd"
cmd = self.dhcpcd_cmd
@@ -294,6 +296,11 @@ class BaseInterface(object):
"""
self.dhclient_cmd = self._find_program_path("dhclient")
output = misc.Run(self.dhclient_cmd + " --version", include_stderr=True)
if '4.' in output:
self.dhclient_needs_verbose = True
else:
self.dhclient_needs_verbose = False
self.dhcpcd_cmd = self._find_program_path("dhcpcd")
self.pump_cmd = self._find_program_path("pump")