diff --git a/cli/wicd-cli.py b/cli/wicd-cli.py index 2087e5c..a7be3d7 100644 --- a/cli/wicd-cli.py +++ b/cli/wicd-cli.py @@ -143,7 +143,7 @@ if options.network_details: # network properties if options.network_property: - options.network_property = option.network_property.lower() + options.network_property = options.network_property.lower() if options.wireless: if options.network >= 0: is_valid_wireless_network_id(options.network) diff --git a/curses/wicd-curses.py b/curses/wicd-curses.py index c088ee9..d32b19d 100755 --- a/curses/wicd-curses.py +++ b/curses/wicd-curses.py @@ -1026,7 +1026,7 @@ setup_dbus() ######################################## if __name__ == '__main__': try: - parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello())) + parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()), prog="wicd-curses") except Exception, e: if "DBus.Error.AccessDenied" in e.get_dbus_name(): print language['access_denied_wc'].replace('$A','\033[1;34m'+wpath.wicd_group+'\033[0m') diff --git a/gtk/gui.py b/gtk/gui.py index 2e52d1c..9027f2b 100644 --- a/gtk/gui.py +++ b/gtk/gui.py @@ -429,7 +429,7 @@ class appGui(object): gobject.idle_add(self.all_network_list.set_sensitive, True) gobject.idle_add(self.status_area.hide_all) if self.statusID: - gobject.idle_add(self.status_bar.remove, 1, self.statusID) + gobject.idle_add(self.status_bar.remove_message, 1, self.statusID) def set_connecting_state(self, info): if not self.connecting: @@ -444,7 +444,7 @@ class appGui(object): gobject.idle_add(self.all_network_list.set_sensitive, False) gobject.idle_add(self.status_area.show_all) if self.statusID: - gobject.idle_add(self.status_bar.remove, 1, self.statusID) + gobject.idle_add(self.status_bar.remove_message, 1, self.statusID) if info[0] == "wireless": gobject.idle_add(self.set_status, str(info[1]) + ': ' + language[str(wireless.CheckWirelessConnectingMessage())]) @@ -700,7 +700,7 @@ class appGui(object): cancel_button.set_sensitive(True) self.all_network_list.set_sensitive(False) if self.statusID: - gobject.idle_add(self.status_bar.remove, 1, self.statusID) + gobject.idle_add(self.status_bar.remove_message, 1, self.statusID) gobject.idle_add(self.set_status, language["disconnecting_active"]) gobject.idle_add(self.status_area.show_all) self.wait_for_events() @@ -791,6 +791,7 @@ class appGui(object): """ self.window.present() + self.window.deiconify() self.wait_for_events() self.is_visible = True daemon.SetGUIOpen(True) diff --git a/gtk/wicd-client.py b/gtk/wicd-client.py index 128c75d..52f67f6 100644 --- a/gtk/wicd-client.py +++ b/gtk/wicd-client.py @@ -550,6 +550,7 @@ class TrayIcon(object): # Create labels self.label = gtk.Label() self.data = gtk.Label() + self.data.set_selectable(True) self.label.show() self.data.show() self.list = [] diff --git a/in/man=wicd.8.in b/in/man=wicd.8.in index 11aa43b..be25f98 100644 --- a/in/man=wicd.8.in +++ b/in/man=wicd.8.in @@ -118,6 +118,12 @@ This file contains settings related to the wireless interface. .br See this file's own man page for more information about it. +.B %ETC%dhclient.conf.template +.br +This is used to replace /etc/dhclient.conf during Wicd activity, +if you're using dhclient(1) as DHCP client. See dhclient.conf(5) +for more information. + .B %ENCRYPTION% .br This directory contains various templates for encrypted (WEP, WPA, etcetera) @@ -132,6 +138,12 @@ when the specified event is preformed upon connection or disconnect from or to any network. Please note that pre/post disconnect scripts may be executed multiple times on already-disconnected interfaces. .br +The scripts will be passed different parameters, depending if Wicd is +acting on a wired or a wireless network. In the former case, "wired +wired wired" will be passed (three times, just for compatibility with +the wireless case). If Wicd is acting on a wireless network, it will +pass "wireless ESSID BSSID" to the script. +.br Available directories are: .br %SCRIPTS%predisconnect @@ -156,6 +168,7 @@ log if you are having connection or other problems. .BR wicd-manager-settings.conf (5), .BR wicd-wired-settings.conf (5), .BR wicd-wireless-settings.conf (5), +.BR dhclient.conf (5), .BR wicd-curses (8), .BR ifconfig (8), .BR iwconfig (8), diff --git a/in/scripts=wicd-client.in b/in/scripts=wicd-client.in index 54a55ff..db6214d 100755 --- a/in/scripts=wicd-client.in +++ b/in/scripts=wicd-client.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh BOLD=$(tput bold) BLUE=$(tput setaf 4) NC=$(tput sgr0) diff --git a/in/scripts=wicd-curses.in b/in/scripts=wicd-curses.in index 45fc544..d70d9d0 100755 --- a/in/scripts=wicd-curses.in +++ b/in/scripts=wicd-curses.in @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh if [ ! -d "$HOME/.wicd" ]; then mkdir -p "$HOME/.wicd" fi diff --git a/in/scripts=wicd.in b/in/scripts=wicd.in index c8abe3e..3206f2b 100755 --- a/in/scripts=wicd.in +++ b/in/scripts=wicd.in @@ -1,3 +1,3 @@ -#!/bin/bash +#!/bin/sh exec %PYTHON% -O %SHARE%daemon/wicd-daemon.py $@ diff --git a/setup.py b/setup.py index e97ea6e..2234dac 100644 --- a/setup.py +++ b/setup.py @@ -436,7 +436,10 @@ class get_translations(Command): import urllib, shutil if os.path.exists('translations'): shutil.rmtree('translations/') + if os.path.exists('po'): + shutil.rmtree('po/') os.makedirs('translations') + os.makedirs('po') filename, headers = urllib.urlretrieve('http://wicd.sourceforge.net/translator/idlist/') id_file = open(filename, 'r') lines = id_file.readlines() @@ -452,11 +455,10 @@ class get_translations(Command): except: print >> sys.stderr, 'error downloading language %s' % id else: - shutil.move(pofile, lang_identifier+'.po') + shutil.move(pofile, 'po/'+lang_identifier+'.po') os.makedirs('translations/'+lang_identifier+'/LC_MESSAGES') os.system('msgfmt --output-file=translations/' + lang_identifier + - '/LC_MESSAGES/wicd.mo ' + lang_identifier + '.po') - os.remove(lang_identifier+'.po') + '/LC_MESSAGES/wicd.mo po/' + lang_identifier + '.po') class uninstall(Command): diff --git a/wicd/configmanager.py b/wicd/configmanager.py index 430cbb5..0dee326 100644 --- a/wicd/configmanager.py +++ b/wicd/configmanager.py @@ -26,7 +26,7 @@ reusable for other purposes as well. import os, copy -from ConfigParser import RawConfigParser +from ConfigParser import RawConfigParser, ParsingError from wicd.misc import Noneify, to_unicode @@ -39,8 +39,17 @@ class ConfigManager(RawConfigParser): self.config_file = path self.debug = debug self.mrk_ws = mark_whitespace - self.read(path) - + try: + self.read(path) + except ParsingError, e: + self.write() + try: + self.read(path) + except ParsingError, p: + import sys + print "Could not start wicd: %s" % p.message + sys.exit(1) + def __repr__(self): return self.config_file diff --git a/wicd/misc.py b/wicd/misc.py index a358add..da42782 100644 --- a/wicd/misc.py +++ b/wicd/misc.py @@ -186,6 +186,8 @@ def ExecuteScripts(scripts_dir, verbose=False, extra_parameters=()): if not os.path.exists(scripts_dir): return for obj in sorted(os.listdir(scripts_dir)): + if obj.startswith(".") or obj.endswith(("~", ".new", ".orig")): + continue obj = os.path.abspath(os.path.join(scripts_dir, obj)) if os.path.isfile(obj) and os.access(obj, os.X_OK): ExecuteScript(os.path.abspath(obj), verbose=verbose, diff --git a/wicd/wicd-daemon.py b/wicd/wicd-daemon.py index b528901..c4a28e7 100644 --- a/wicd/wicd-daemon.py +++ b/wicd/wicd-daemon.py @@ -948,12 +948,14 @@ class WicdDaemon(dbus.service.Object): os.chmod(app_conf.get_config(), 0600) os.chmod(wireless_conf, 0600) os.chmod(wired_conf, 0600) + os.chmod(dhclient_conf, 0644) # Make root own them print "chowning configuration files root:root..." os.chown(app_conf.get_config(), 0, 0) os.chown(wireless_conf, 0, 0) os.chown(wired_conf, 0, 0) + os.chown(dhclient_conf, 0, 0) print "Using wireless interface..." + self.GetWirelessInterface() print "Using wired interface..." + self.GetWiredInterface() @@ -1702,6 +1704,7 @@ def main(argv): # wicd exploded if not os.path.exists(backup_location): shutil.copy2('/etc/resolv.conf', backup_location) + os.chmod(backup_location, 0644) except IOError: print 'error backing up resolv.conf' @@ -1748,6 +1751,7 @@ def main(argv): # restore resolv.conf on quit try: shutil.move(wpath.varlib + 'resolv.conf.orig', '/etc/resolv.conf') + os.chmod('/etc/resolv.conf', 0644) except IOError: print 'error restoring resolv.conf' diff --git a/wicd/wnettools.py b/wicd/wnettools.py index 6ab4ebf..4d6d80e 100644 --- a/wicd/wnettools.py +++ b/wicd/wnettools.py @@ -325,6 +325,7 @@ class BaseInterface(object): output_conf.close() dhclient_template.close() + os.chmod(dhclient_conf_path, 0644) if not client_name or not cmd: print "WARNING: Failed to find a valid dhcp client!" @@ -619,6 +620,7 @@ class BaseInterface(object): else: print "ERROR: no dhcp client found" ret = None + self.dhcp_object.wait() return ret @neediface(False) @@ -1088,9 +1090,7 @@ class BaseWirelessInterface(BaseInterface): bssid -- bssid of the network """ - cmd = ['iwconfig', self.iface, 'essid', essid] - if self.verbose: print str(cmd) - misc.Run(cmd) + self.SetEssid(essid) base = "iwconfig %s" % self.iface if channel and str(channel).isdigit(): cmd = "%s channel %s" % (base, str(channel))