mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38:00 +01:00
Changed script execution behavior to fork before running. Causes more reliable execution but can leave zombies.
This commit is contained in:
36
daemon.py
36
daemon.py
@@ -299,7 +299,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
else:
|
else:
|
||||||
defaultNetwork = self.GetDefaultWiredNetwork()
|
defaultNetwork = self.GetDefaultWiredNetwork()
|
||||||
if defaultNetwork != None:
|
if defaultNetwork != None:
|
||||||
self.ReadWiredNetworkProfile(defaultNetwork)
|
self.ReadWiredNetworkProfile(defaultNetwork)
|
||||||
self.ConnectWired()
|
self.ConnectWired()
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
print "Attempting to autoconnect with wired interface..."
|
print "Attempting to autoconnect with wired interface..."
|
||||||
@@ -353,14 +353,14 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
else:
|
else:
|
||||||
print 'autoconnect failed because wireless interface == None'
|
print 'autoconnect failed because wireless interface == None'
|
||||||
#end function AutoConnect
|
#end function AutoConnect
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetGlobalDNSAddresses(self):
|
def GetGlobalDNSAddresses(self):
|
||||||
'''returns the global dns addresses'''
|
'''returns the global dns addresses'''
|
||||||
print 'returning global dns addresses to client'
|
print 'returning global dns addresses to client'
|
||||||
return (misc.noneToString(self.dns1),misc.noneToString(self.dns2),misc.noneToString(self.dns3))
|
return (misc.noneToString(self.dns1),misc.noneToString(self.dns2),misc.noneToString(self.dns3))
|
||||||
#end function GetWirelessInterface
|
#end function GetWirelessInterface
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def CheckIfConnecting(self):
|
def CheckIfConnecting(self):
|
||||||
'''returns if a network connection is being made'''
|
'''returns if a network connection is being made'''
|
||||||
@@ -369,12 +369,12 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
#end function CheckIfConnecting
|
#end function CheckIfConnecting
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def SetNeedWiredProfileChooser(self,val):
|
def SetNeedWiredProfileChooser(self,val):
|
||||||
self.need_profile_chooser = val
|
self.need_profile_chooser = val
|
||||||
#end function SetNeedWiredProfileChooser
|
#end function SetNeedWiredProfileChooser
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetNeedWiredProfileChooser(self):
|
def GetNeedWiredProfileChooser(self):
|
||||||
return self.need_profile_chooser
|
return self.need_profile_chooser
|
||||||
@@ -417,7 +417,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
self.SetWirelessProperty(networkid,"beforescript",script)
|
self.SetWirelessProperty(networkid,"beforescript",script)
|
||||||
self.wifi.before_script = script
|
self.wifi.before_script = script
|
||||||
#end function SetWirelessBeforeScript
|
#end function SetWirelessBeforeScript
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wireless')
|
@dbus.service.method('org.wicd.daemon.wireless')
|
||||||
def SetWirelessDisconnectScript(self,networkid,script):
|
def SetWirelessDisconnectScript(self,networkid,script):
|
||||||
if script == '':
|
if script == '':
|
||||||
@@ -621,7 +621,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
self.SetWiredProperty("beforescript",script)
|
self.SetWiredProperty("beforescript",script)
|
||||||
self.wired.before_script = script
|
self.wired.before_script = script
|
||||||
#end function SetWiredBeforeScript
|
#end function SetWiredBeforeScript
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def SetWiredDisconnectScript(self,script):
|
def SetWiredDisconnectScript(self,script):
|
||||||
'''sets script to run on connection disconnect'''
|
'''sets script to run on connection disconnect'''
|
||||||
@@ -639,7 +639,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
self.SetWiredProperty("afterscript",script)
|
self.SetWiredProperty("afterscript",script)
|
||||||
self.wired.after_script = script
|
self.wired.after_script = script
|
||||||
#end function SetWiredAfterScript
|
#end function SetWiredAfterScript
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def SetWiredAutoConnectMethod(self,method):
|
def SetWiredAutoConnectMethod(self,method):
|
||||||
'''sets which method the user wants to autoconnect to wired networks'''
|
'''sets which method the user wants to autoconnect to wired networks'''
|
||||||
@@ -651,13 +651,13 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
config.set("Settings","wired_connect_mode",int(method))
|
config.set("Settings","wired_connect_mode",int(method))
|
||||||
config.write(open(self.app_conf,"w"))
|
config.write(open(self.app_conf,"w"))
|
||||||
self.wired_connect_mode = method
|
self.wired_connect_mode = method
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def GetWiredAutoConnectMethod(self):
|
def GetWiredAutoConnectMethod(self):
|
||||||
'''returns the wired autoconnect method'''
|
'''returns the wired autoconnect method'''
|
||||||
return int(self.wired_connect_mode)
|
return int(self.wired_connect_mode)
|
||||||
#end function GetWiredAutoConnectMethod
|
#end function GetWiredAutoConnectMethod
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def CheckWiredConnectingMessage(self):
|
def CheckWiredConnectingMessage(self):
|
||||||
'''returns the wired interface\'s status message'''
|
'''returns the wired interface\'s status message'''
|
||||||
@@ -691,7 +691,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
print 'WiredNetwork does not exist'
|
print 'WiredNetwork does not exist'
|
||||||
return False
|
return False
|
||||||
#end function GetWiredProperty
|
#end function GetWiredProperty
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.wired')
|
@dbus.service.method('org.wicd.daemon.wired')
|
||||||
def SetAlwaysShowWiredInterface(self,value):
|
def SetAlwaysShowWiredInterface(self,value):
|
||||||
print 'setting always show wired interface'
|
print 'setting always show wired interface'
|
||||||
@@ -795,7 +795,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.config')
|
@dbus.service.method('org.wicd.daemon.config')
|
||||||
def DeleteWiredNetworkProfile(self,profilename):
|
def DeleteWiredNetworkProfile(self,profilename):
|
||||||
profilename = profilename.encode('utf-8')
|
profilename = profilename.encode('utf-8')
|
||||||
print "deleting profile for " + str(profilename)
|
print "deleting profile for " + str(profilename)
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
config.read(self.wired_conf)
|
config.read(self.wired_conf)
|
||||||
@@ -806,7 +806,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
config.write( open(self.wired_conf,"w"))
|
config.write( open(self.wired_conf,"w"))
|
||||||
return "100: Profile Deleted"
|
return "100: Profile Deleted"
|
||||||
#end function DeleteWiredNetworkProfile
|
#end function DeleteWiredNetworkProfile
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon.config')
|
@dbus.service.method('org.wicd.daemon.config')
|
||||||
def SaveWiredNetworkProfile(self,profilename):
|
def SaveWiredNetworkProfile(self,profilename):
|
||||||
#should include: profilename,ip,netmask,gateway,dns1,dns2
|
#should include: profilename,ip,netmask,gateway,dns1,dns2
|
||||||
@@ -894,7 +894,7 @@ class ConnectionWizard(dbus.service.Object):
|
|||||||
self.LastScan[id]["disconnectscript"]=misc.Noneify(config.get(self.LastScan[id]["bssid"],"disconnectscript"))
|
self.LastScan[id]["disconnectscript"]=misc.Noneify(config.get(self.LastScan[id]["bssid"],"disconnectscript"))
|
||||||
else:
|
else:
|
||||||
self.LastScan[id]["disconnectscript"] = None
|
self.LastScan[id]["disconnectscript"] = None
|
||||||
|
|
||||||
#read the essid because we be needing to name those hidden
|
#read the essid because we be needing to name those hidden
|
||||||
#wireless networks now - but only read it if it is hidden
|
#wireless networks now - but only read it if it is hidden
|
||||||
if self.LastScan[id]["hidden"] == True:
|
if self.LastScan[id]["hidden"] == True:
|
||||||
@@ -1123,11 +1123,11 @@ def daemonize():
|
|||||||
|
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
""" The main daemon program.
|
""" The main daemon program.
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
argv -- The arguments passed to the script.
|
argv -- The arguments passed to the script.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
do_daemonize = True
|
do_daemonize = True
|
||||||
@@ -1136,7 +1136,7 @@ def main(argv):
|
|||||||
auto_scan = True
|
auto_scan = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'feos',
|
opts, args = getopt.getopt(sys.argv[1:], 'feos',
|
||||||
['help', 'no-daemon', 'no-stderr', 'no-stdout', 'no-scan'])
|
['help', 'no-daemon', 'no-stderr', 'no-stdout', 'no-scan'])
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
# Print help information and exit
|
# Print help information and exit
|
||||||
@@ -1159,7 +1159,7 @@ def main(argv):
|
|||||||
if do_daemonize: daemonize()
|
if do_daemonize: daemonize()
|
||||||
|
|
||||||
if redirect_stderr or redirect_stdout: output = LogWriter()
|
if redirect_stderr or redirect_stdout: output = LogWriter()
|
||||||
if redirect_stdout: sys.stdout = output
|
if redirect_stdout: sys.stdout = output
|
||||||
if redirect_stderr: sys.stderr = output
|
if redirect_stderr: sys.stderr = output
|
||||||
|
|
||||||
print '---------------------------'
|
print '---------------------------'
|
||||||
|
|||||||
17
misc.py
17
misc.py
@@ -37,7 +37,7 @@ def PromptToStartDaemon():
|
|||||||
print 'You need to start the daemon before using the gui or tray. Use the command \'sudo /etc/init.d/wicd start\'.'
|
print 'You need to start the daemon before using the gui or tray. Use the command \'sudo /etc/init.d/wicd start\'.'
|
||||||
|
|
||||||
def RunRegex(regex,string):
|
def RunRegex(regex,string):
|
||||||
m = regex.search( string )
|
m = regex.search(string)
|
||||||
if m:
|
if m:
|
||||||
return m.groups()[0]
|
return m.groups()[0]
|
||||||
else:
|
else:
|
||||||
@@ -46,6 +46,19 @@ def RunRegex(regex,string):
|
|||||||
def WriteLine(file,text):
|
def WriteLine(file,text):
|
||||||
file.write(text + "\n")
|
file.write(text + "\n")
|
||||||
|
|
||||||
|
def ExecuteScript(script):
|
||||||
|
pid = os.fork()
|
||||||
|
if not pid:
|
||||||
|
os.setsid()
|
||||||
|
os.umask(0)
|
||||||
|
pid = os.fork()
|
||||||
|
if not pid:
|
||||||
|
print Run('./run-script.py ' + script)
|
||||||
|
os._exit(0)
|
||||||
|
os._exit(0)
|
||||||
|
os.wait()
|
||||||
|
|
||||||
|
|
||||||
def ReadFile(filename):
|
def ReadFile(filename):
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
return None
|
return None
|
||||||
@@ -136,6 +149,6 @@ def LoadEncryptionMethods():
|
|||||||
def noneToString(text):
|
def noneToString(text):
|
||||||
'''used for putting text in a text box if the value to put in is 'None' the box will be blank'''
|
'''used for putting text in a text box if the value to put in is 'None' the box will be blank'''
|
||||||
if text == None or text == "None" or text == "":
|
if text == None or text == "None" or text == "":
|
||||||
return "None"
|
return "None"
|
||||||
else:
|
else:
|
||||||
return str(text)
|
return str(text)
|
||||||
|
|||||||
@@ -75,18 +75,18 @@ class ConnectThread(threading.Thread):
|
|||||||
|
|
||||||
Useless on it's own, this class provides the generic functions
|
Useless on it's own, this class provides the generic functions
|
||||||
necessary for connecting using a separate thread. """
|
necessary for connecting using a separate thread. """
|
||||||
|
|
||||||
is_connecting = None
|
is_connecting = None
|
||||||
connecting_thread = None
|
connecting_thread = None
|
||||||
should_die = False
|
should_die = False
|
||||||
lock = thread.allocate_lock()
|
lock = thread.allocate_lock()
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, network, wireless, wired,
|
def __init__(self, network, wireless, wired,
|
||||||
before_script, after_script, disconnect_script, gdns1,
|
before_script, after_script, disconnect_script, gdns1,
|
||||||
gdns2, gdns3):
|
gdns2, gdns3):
|
||||||
""" Initialise the required object variables and the thread.
|
""" Initialise the required object variables and the thread.
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
network -- the network to connect to
|
network -- the network to connect to
|
||||||
wireless -- name of the wireless interface
|
wireless -- name of the wireless interface
|
||||||
@@ -107,7 +107,7 @@ class ConnectThread(threading.Thread):
|
|||||||
self.before_script = before_script
|
self.before_script = before_script
|
||||||
self.after_script = after_script
|
self.after_script = after_script
|
||||||
self.disconnect_script = disconnect_script
|
self.disconnect_script = disconnect_script
|
||||||
|
|
||||||
self.global_dns_1 = gdns1
|
self.global_dns_1 = gdns1
|
||||||
self.global_dns_2 = gdns2
|
self.global_dns_2 = gdns2
|
||||||
self.global_dns_3 = gdns3
|
self.global_dns_3 = gdns3
|
||||||
@@ -116,8 +116,8 @@ class ConnectThread(threading.Thread):
|
|||||||
|
|
||||||
|
|
||||||
def SetStatus(self, status):
|
def SetStatus(self, status):
|
||||||
""" Set the threads current status message in a thread-safe way.
|
""" Set the threads current status message in a thread-safe way.
|
||||||
|
|
||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
status -- the current connection status
|
status -- the current connection status
|
||||||
|
|
||||||
@@ -128,8 +128,8 @@ class ConnectThread(threading.Thread):
|
|||||||
|
|
||||||
|
|
||||||
def GetStatus(self):
|
def GetStatus(self):
|
||||||
""" Get the threads current status message in a thread-safe way.
|
""" Get the threads current status message in a thread-safe way.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The current connection status.
|
The current connection status.
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ class Wireless(Controller):
|
|||||||
misc.Run('iptables -A FORWARD -j REJECT --reject-with icmp-host-unreachable')
|
misc.Run('iptables -A FORWARD -j REJECT --reject-with icmp-host-unreachable')
|
||||||
misc.Run('iptables -P FORWARD DROP')
|
misc.Run('iptables -P FORWARD DROP')
|
||||||
misc.Run('iptables -A fw-interfaces -i ' + self.wireless_interface + ' -j ACCEPT')
|
misc.Run('iptables -A fw-interfaces -i ' + self.wireless_interface + ' -j ACCEPT')
|
||||||
net_ip = '.'.join(ip_parts[0:3]) + '.0'
|
net_ip = '.'.join(ip_parts[0:3]) + '.0'
|
||||||
misc.Run('iptables -t nat -A POSTROUTING -s ' + net_ip + '/255.255.255.0 -o ' + self.wired_interface + ' -j MASQUERADE')
|
misc.Run('iptables -t nat -A POSTROUTING -s ' + net_ip + '/255.255.255.0 -o ' + self.wired_interface + ' -j MASQUERADE')
|
||||||
misc.Run('echo 1 > /proc/sys/net/ipv4/ip_forward') # Enable routing
|
misc.Run('echo 1 > /proc/sys/net/ipv4/ip_forward') # Enable routing
|
||||||
|
|
||||||
@@ -285,9 +285,9 @@ class Wireless(Controller):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
The first available wireless interface.
|
The first available wireless interface.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return wnettools.GetWirelessInterfaces()
|
wnettools.GetWirelessInterfaces()
|
||||||
|
|
||||||
|
|
||||||
def Disconnect(self):
|
def Disconnect(self):
|
||||||
@@ -295,7 +295,7 @@ class Wireless(Controller):
|
|||||||
wiface = wnettools.WirelessInterface(self.wireless_interface, self.wpa_driver)
|
wiface = wnettools.WirelessInterface(self.wireless_interface, self.wpa_driver)
|
||||||
if self.disconnect_script != None:
|
if self.disconnect_script != None:
|
||||||
print 'Running wireless network disconnect script'
|
print 'Running wireless network disconnect script'
|
||||||
misc.Run(self.disconnect_script)
|
misc.ExecuteScript(self.disconnect_script)
|
||||||
|
|
||||||
wiface.SetAddress('0.0.0.0')
|
wiface.SetAddress('0.0.0.0')
|
||||||
wiface.Down()
|
wiface.Down()
|
||||||
@@ -328,7 +328,7 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
gdns3 -- global DNS server 3
|
gdns3 -- global DNS server 3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
ConnectThread.__init__(self, network, wireless, wired,
|
ConnectThread.__init__(self, network, wireless, wired,
|
||||||
before_script, after_script, disconnect_script, gdns1,
|
before_script, after_script, disconnect_script, gdns1,
|
||||||
gdns2, gdns3)
|
gdns2, gdns3)
|
||||||
self.wpa_driver = wpa_driver
|
self.wpa_driver = wpa_driver
|
||||||
@@ -356,7 +356,7 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
# Execute pre-connection script if necessary
|
# Execute pre-connection script if necessary
|
||||||
if self.before_script != '' and self.before_script != None:
|
if self.before_script != '' and self.before_script != None:
|
||||||
print 'Executing pre-connection script'
|
print 'Executing pre-connection script'
|
||||||
print misc.Run('run-script.py ' + self.before_script)
|
print misc.ExecuteScript(self.before_script)
|
||||||
|
|
||||||
# Put it down
|
# Put it down
|
||||||
print 'Interface down'
|
print 'Interface down'
|
||||||
@@ -408,7 +408,7 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
self.network['channel'], self.network['bssid'])
|
self.network['channel'], self.network['bssid'])
|
||||||
|
|
||||||
# Authenticate after association for Ralink legacy cards.
|
# Authenticate after association for Ralink legacy cards.
|
||||||
if self.wpa_driver == 'ralink legacy':
|
if self.wpa_driver == 'ralink legacy':
|
||||||
if self.network.get('key') != None:
|
if self.network.get('key') != None:
|
||||||
wiface.Authenticate(self.network)
|
wiface.Authenticate(self.network)
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
self.SetStatus('setting_static_dns')
|
self.SetStatus('setting_static_dns')
|
||||||
if self.network.get('use_global_dns'):
|
if self.network.get('use_global_dns'):
|
||||||
wnettools.SetDNS(misc.Noneify(self.global_dns_1),
|
wnettools.SetDNS(misc.Noneify(self.global_dns_1),
|
||||||
misc.Noneify(self.global_dns_2),
|
misc.Noneify(self.global_dns_2),
|
||||||
misc.Noneify(self.global_dns_3))
|
misc.Noneify(self.global_dns_3))
|
||||||
else:
|
else:
|
||||||
wnettools.SetDNS(self.network.get('dns1'),
|
wnettools.SetDNS(self.network.get('dns1'),
|
||||||
@@ -445,8 +445,8 @@ class WirelessConnectThread(ConnectThread):
|
|||||||
|
|
||||||
#execute post-connection script if necessary
|
#execute post-connection script if necessary
|
||||||
if misc.Noneify(self.after_script):
|
if misc.Noneify(self.after_script):
|
||||||
print 'executing post connection script'
|
print 'Executing post-connection script'
|
||||||
print misc.Run('./run-script.py ' + self.after_script)
|
misc.ExecuteScript(self.after_script)
|
||||||
|
|
||||||
self.SetStatus('done')
|
self.SetStatus('done')
|
||||||
print 'Connecting thread exiting.'
|
print 'Connecting thread exiting.'
|
||||||
@@ -479,7 +479,7 @@ class Wired(Controller):
|
|||||||
Keyword arguments:
|
Keyword arguments:
|
||||||
network -- network to connect to
|
network -- network to connect to
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.connecting_thread = WiredConnectThread(network,
|
self.connecting_thread = WiredConnectThread(network,
|
||||||
self.wireless_interface, self.wired_interface,
|
self.wireless_interface, self.wired_interface,
|
||||||
self.before_script, self.after_script,
|
self.before_script, self.after_script,
|
||||||
@@ -521,7 +521,7 @@ class WiredConnectThread(ConnectThread):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, network, wireless, wired,
|
def __init__(self, network, wireless, wired,
|
||||||
before_script, after_script, disconnect_script, gdns1,
|
before_script, after_script, disconnect_script, gdns1,
|
||||||
gdns2, gdns3):
|
gdns2, gdns3):
|
||||||
""" Initialise the thread with network information.
|
""" Initialise the thread with network information.
|
||||||
@@ -538,7 +538,7 @@ class WiredConnectThread(ConnectThread):
|
|||||||
gdns3 -- global DNS server 3
|
gdns3 -- global DNS server 3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
ConnectThread.__init__(self, network, wireless, wired,
|
ConnectThread.__init__(self, network, wireless, wired,
|
||||||
before_script, after_script, disconnect_script, gdns1,
|
before_script, after_script, disconnect_script, gdns1,
|
||||||
gdns2, gdns3)
|
gdns2, gdns3)
|
||||||
|
|
||||||
@@ -563,8 +563,8 @@ class WiredConnectThread(ConnectThread):
|
|||||||
|
|
||||||
# Execute pre-connection script if necessary
|
# Execute pre-connection script if necessary
|
||||||
if self.before_script != '' and self.before_script != None:
|
if self.before_script != '' and self.before_script != None:
|
||||||
print 'Executing pre-connection script'
|
print 'executing pre-connectiong script'
|
||||||
print misc.Run('run-script.py ' + self.before_script)
|
misc.ExecuteScript(self.before_script)
|
||||||
|
|
||||||
# Put it down
|
# Put it down
|
||||||
print 'Interface down'
|
print 'Interface down'
|
||||||
@@ -617,7 +617,7 @@ class WiredConnectThread(ConnectThread):
|
|||||||
self.SetStatus('setting_static_dns')
|
self.SetStatus('setting_static_dns')
|
||||||
if self.network.get('use_global_dns'):
|
if self.network.get('use_global_dns'):
|
||||||
wnettools.SetDNS(misc.Noneify(self.global_dns_1),
|
wnettools.SetDNS(misc.Noneify(self.global_dns_1),
|
||||||
misc.Noneify(self.global_dns_2),
|
misc.Noneify(self.global_dns_2),
|
||||||
misc.Noneify(self.global_dns_3))
|
misc.Noneify(self.global_dns_3))
|
||||||
else:
|
else:
|
||||||
wnettools.SetDNS(self.network.get('dns1'),
|
wnettools.SetDNS(self.network.get('dns1'),
|
||||||
@@ -626,7 +626,7 @@ class WiredConnectThread(ConnectThread):
|
|||||||
#execute post-connection script if necessary
|
#execute post-connection script if necessary
|
||||||
if misc.Noneify(self.after_script):
|
if misc.Noneify(self.after_script):
|
||||||
print 'executing post connection script'
|
print 'executing post connection script'
|
||||||
print misc.Run('./run-script.py ' + self.after_script)
|
misc.ExecuteScript(self.after_script)
|
||||||
|
|
||||||
self.SetStatus('done')
|
self.SetStatus('done')
|
||||||
print 'Connecting thread exiting.'
|
print 'Connecting thread exiting.'
|
||||||
|
|||||||
Reference in New Issue
Block a user