self.config_ready = None
self.getInterfaces()
+ def onRemoteRootFS(self):
+ fp = file('/proc/mounts', 'r')
+ mounts = fp.readlines()
+ fp.close()
+ for line in mounts:
+ parts = line.strip().split(' ')
+ if parts[1] == '/' and (parts[2] == 'nfs' or parts[2] == 'smbfs'):
+ return True
+ return False
+
def getInterfaces(self, callback = None):
devicesPattern = re_compile('[a-z]+[0-9]+')
self.configuredInterfaces = []
for line in result:
try:
device = devicesPattern.search(line).group()
- if device == 'wifi0':
+ if device in ('wifi0', 'wmaster0'):
continue
self.getDataForInterface(device, callback)
except AttributeError:
ifaces[currif]["gateway"] = map(int, split[1].split('.'))
if self.ifaces[currif].has_key("gateway"):
if self.ifaces[currif]["gateway"] != ifaces[currif]["gateway"] and ifaces[currif]["dhcp"] == False:
- self.ifaces[currif]["gateway"] = map(int, split[1].split('.'))
+ self.ifaces[currif]["gateway"] = map(int, split[1].split('.'))
if (split[0] == "pre-up"):
if self.ifaces[currif].has_key("preup"):
self.ifaces[currif]["preup"] = i
print "nameservers:", self.nameservers
def deactivateNetworkConfig(self, callback = None):
+ if self.onRemoteRootFS():
+ if callback is not None:
+ callback(True)
+ return
self.deactivateConsole = Console()
self.commands = []
self.commands.append("/etc/init.d/avahi-daemon stop")
callback(True)
def activateNetworkConfig(self, callback = None):
+ if self.onRemoteRootFS():
+ if callback is not None:
+ callback(True)
+ return
self.activateConsole = Console()
self.commands = []
self.commands.append("/etc/init.d/networking start")
self.nameservers[i] = newnameserver
def resetNetworkConfig(self, mode='lan', callback = None):
+ if self.onRemoteRootFS():
+ if callback is not None:
+ callback(True)
+ return
self.resetNetworkConsole = Console()
self.commands = []
self.commands.append("/etc/init.d/avahi-daemon stop")
statecallback(self.NetworkState)
def restartNetwork(self,callback = None):
+ if self.onRemoteRootFS():
+ if callback is not None:
+ callback(True)
+ return
self.restartConsole = Console()
self.config_ready = False
self.msgPlugins()
statecallback(self.DnsState)
def deactivateInterface(self,iface,callback = None):
+ if self.onRemoteRootFS():
+ if callback is not None:
+ callback(True)
+ return
self.deactivateInterfaceConsole = Console()
self.commands = []
cmd1 = "ip addr flush " + iface