mirror of
https://github.com/gryf/wicd.git
synced 2026-02-19 00:15:47 +01:00
Merged main experimental branch changes as of r208.
This commit is contained in:
@@ -17,10 +17,6 @@ wicd_start() {
|
|||||||
else
|
else
|
||||||
echo "Starting wicd daemon..."
|
echo "Starting wicd daemon..."
|
||||||
wicd 2>/dev/null 1>&2
|
wicd 2>/dev/null 1>&2
|
||||||
# Activate the pm-utils sleep hook
|
|
||||||
if [ ! -x /usr/lib/pm-utils/sleep.d/55wicd ]; then
|
|
||||||
chmod +x /usr/lib/pm-utils/sleep.d/55wicd
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,11 +28,6 @@ wicd_stop() {
|
|||||||
else
|
else
|
||||||
pkill -f python.*wicd-daemon.py 2>/dev/null
|
pkill -f python.*wicd-daemon.py 2>/dev/null
|
||||||
fi
|
fi
|
||||||
# Deactivate the pm-utils sleep hook
|
|
||||||
if [ -x /usr/lib/pm-utils/sleep.d/55wicd ]; then
|
|
||||||
chmod -x /usr/lib/pm-utils/sleep.d/55wicd
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# See how we were called and take appropriate action
|
# See how we were called and take appropriate action
|
||||||
|
|||||||
0
wicd/autoconnect.py
Normal file → Executable file
0
wicd/autoconnect.py
Normal file → Executable file
@@ -113,3 +113,6 @@ class ConfigManager(ConfigParser):
|
|||||||
"""
|
"""
|
||||||
if self.has_section(section):
|
if self.has_section(section):
|
||||||
ConfigParser.remove_section(self, section)
|
ConfigParser.remove_section(self, section)
|
||||||
|
|
||||||
|
def reload(self):
|
||||||
|
self.read(self.config_file)
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ def write_scripts(network, network_type, script_info):
|
|||||||
con.set(network, "afterscript", script_info["post_entry"])
|
con.set(network, "afterscript", script_info["post_entry"])
|
||||||
con.set(network, "disconnectscript", script_info["disconnect_entry"])
|
con.set(network, "disconnectscript", script_info["disconnect_entry"])
|
||||||
con.write(open(wired_conf, "w"))
|
con.write(open(wired_conf, "w"))
|
||||||
|
wired.ReloadConfig()
|
||||||
wired.ReadWiredNetworkProfile(network)
|
wired.ReadWiredNetworkProfile(network)
|
||||||
wired.SaveWiredNetworkProfile(network)
|
wired.SaveWiredNetworkProfile(network)
|
||||||
else:
|
else:
|
||||||
@@ -133,9 +134,11 @@ def write_scripts(network, network_type, script_info):
|
|||||||
con.set(bssid, "afterscript", script_info["post_entry"])
|
con.set(bssid, "afterscript", script_info["post_entry"])
|
||||||
con.set(bssid, "disconnectscript", script_info["disconnect_entry"])
|
con.set(bssid, "disconnectscript", script_info["disconnect_entry"])
|
||||||
con.write(open(wireless_conf, "w"))
|
con.write(open(wireless_conf, "w"))
|
||||||
|
wireless.ReloadConfig()
|
||||||
wireless.ReadWirelessNetworkProfile(int(network))
|
wireless.ReadWirelessNetworkProfile(int(network))
|
||||||
wireless.SaveWirelessNetworkProfile(int(network))
|
wireless.SaveWirelessNetworkProfile(int(network))
|
||||||
|
|
||||||
|
|
||||||
def main (argv):
|
def main (argv):
|
||||||
""" Runs the script configuration dialog. """
|
""" Runs the script configuration dialog. """
|
||||||
if len(argv) < 2:
|
if len(argv) < 2:
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ class ConnectionStatus(object):
|
|||||||
|
|
||||||
# Some checks to keep reconnect retries from going crazy.
|
# Some checks to keep reconnect retries from going crazy.
|
||||||
if self.reconnect_tries > 2 and \
|
if self.reconnect_tries > 2 and \
|
||||||
time.time() - self.last_reconnect_time < 300:
|
(time.time() - self.last_reconnect_time) < 300:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.reconnecting = True
|
self.reconnecting = True
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
if self.suspended:
|
if self.suspended:
|
||||||
self.Disconnect()
|
self.Disconnect()
|
||||||
else:
|
else:
|
||||||
self.forced_disconnect = False
|
self.SetForcedDisconnect(False)
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetSuspend(self):
|
def GetSuspend(self):
|
||||||
@@ -1066,7 +1066,8 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
def SaveWirelessNetworkProfile(self, id):
|
def SaveWirelessNetworkProfile(self, id):
|
||||||
""" Writes a wireless profile to disk. """
|
""" Writes a wireless profile to disk. """
|
||||||
def write_script_ent(prof, script):
|
def write_script_ent(prof, script):
|
||||||
self.config.set(prof, script, None)
|
if not self.config.has_option(prof, script):
|
||||||
|
self.config.set(prof, script, None)
|
||||||
|
|
||||||
cur_network = self.LastScan[id]
|
cur_network = self.LastScan[id]
|
||||||
bssid_key = cur_network["bssid"]
|
bssid_key = cur_network["bssid"]
|
||||||
@@ -1088,12 +1089,12 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
|
|
||||||
write_script_ent(bssid_key, "beforescript")
|
write_script_ent(bssid_key, "beforescript")
|
||||||
write_script_ent(bssid_key, "afterscript")
|
write_script_ent(bssid_key, "afterscript")
|
||||||
write_script_ent(bssid_key, "disconnect")
|
write_script_ent(bssid_key, "disconnectscript")
|
||||||
|
|
||||||
if cur_network["use_settings_globally"]:
|
if cur_network["use_settings_globally"]:
|
||||||
write_script_ent(essid_key, "beforescript")
|
write_script_ent(essid_key, "beforescript")
|
||||||
write_script_ent(essid_key, "afterscript")
|
write_script_ent(essid_key, "afterscript")
|
||||||
write_script_ent(essid_key, "disconnect")
|
write_script_ent(essid_key, "disconnectscript")
|
||||||
|
|
||||||
self.config.write()
|
self.config.write()
|
||||||
|
|
||||||
@@ -1120,7 +1121,12 @@ class WirelessDaemon(dbus.service.Object):
|
|||||||
""" Removes the global entry for the networkid provided. """
|
""" Removes the global entry for the networkid provided. """
|
||||||
essid_key = "essid:" + str(self.LastScan[networkid])
|
essid_key = "essid:" + str(self.LastScan[networkid])
|
||||||
self.config.remove_section(essid_key)
|
self.config.remove_section(essid_key)
|
||||||
|
|
||||||
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
|
def ReloadConfig(self):
|
||||||
|
""" Reloads the active config file. """
|
||||||
|
self.config.reload()
|
||||||
|
|
||||||
@dbus.service.signal(dbus_interface='org.wicd.daemon.wireless', signature='')
|
@dbus.service.signal(dbus_interface='org.wicd.daemon.wireless', signature='')
|
||||||
def SendStartScanSignal(self):
|
def SendStartScanSignal(self):
|
||||||
""" Emits a signal announcing a scan has started. """
|
""" Emits a signal announcing a scan has started. """
|
||||||
@@ -1395,6 +1401,11 @@ class WiredDaemon(dbus.service.Object):
|
|||||||
if not sections:
|
if not sections:
|
||||||
sections = [""]
|
sections = [""]
|
||||||
return sections
|
return sections
|
||||||
|
|
||||||
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
|
def ReloadConfig(self):
|
||||||
|
""" Reloads the active config file. """
|
||||||
|
self.config.reload()
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
"""
|
"""
|
||||||
if not self.iface: return False
|
if not self.iface: return False
|
||||||
cmd = ['iwconfig', self.iface, 'essid', essid]
|
cmd = ['iwconfig', self.iface, 'essid', essid]
|
||||||
if channel:
|
if channel and str(channel).isdigit():
|
||||||
cmd.extend(['channel', str(channel)])
|
cmd.extend(['channel', str(channel)])
|
||||||
if bssid:
|
if bssid:
|
||||||
cmd.extend(['ap', bssid])
|
cmd.extend(['ap', bssid])
|
||||||
@@ -770,7 +770,8 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
if not wpa_pass_path: return None
|
if not wpa_pass_path: return None
|
||||||
key_pattern = re.compile('network={.*?\spsk=(.*?)\n}.*',
|
key_pattern = re.compile('network={.*?\spsk=(.*?)\n}.*',
|
||||||
re.I | re.M | re.S)
|
re.I | re.M | re.S)
|
||||||
cmd = ' '.join([wpa_pass_path, network['essid'], network['key']])
|
cmd = [wpa_pass_path, network['essid'], network['key']]
|
||||||
|
if self.verbose: print cmd
|
||||||
return misc.RunRegex(key_pattern, misc.Run(cmd))
|
return misc.RunRegex(key_pattern, misc.Run(cmd))
|
||||||
|
|
||||||
def Authenticate(self, network):
|
def Authenticate(self, network):
|
||||||
@@ -784,9 +785,10 @@ class BaseWirelessInterface(BaseInterface):
|
|||||||
if self.wpa_driver == RALINK_DRIVER:
|
if self.wpa_driver == RALINK_DRIVER:
|
||||||
self._AuthenticateRalinkLegacy(network)
|
self._AuthenticateRalinkLegacy(network)
|
||||||
else:
|
else:
|
||||||
cmd = ''.join(['wpa_supplicant -B -i ', self.iface, ' -c ',
|
cmd = ['wpa_supplicant', '-B', '-i', self.iface, '-c',
|
||||||
wpath.networks, network['bssid'].replace(':','').lower(),
|
os.path.join(wpath.networks,
|
||||||
' -D ', self.wpa_driver])
|
network['bssid'].replace(':', '').lower()),
|
||||||
|
'-D', self.wpa_driver]
|
||||||
if self.verbose: print cmd
|
if self.verbose: print cmd
|
||||||
misc.Run(cmd)
|
misc.Run(cmd)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user