1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 04:48:00 +01:00

Added distro-specific init scripts based on those used by NM (these are very experimental and likely broken in many cases).

Updated setup.py to pick which initscript to install based on the distro detected.
Updated MANIFEST.in to make sure launchdaemon.sh is included in the sdist build.
Fixed a bunch of crash bugs in tool detection system when tools are detected.
Made tool detection work correctly when "which" returns output if no match is found (as opposed to no output).  Eventually we might want to hardcode possible paths instead of using which at all...
Fixed some message formatting in the daemon.
Added some docstrings.
Added a pidfile system for increased initscript compatibility (sort of, it's somewhat incomplete).
This commit is contained in:
imdano
2008-03-24 00:03:35 +00:00
parent c055ea0d36
commit ef9b5cc7f3
18 changed files with 567 additions and 188 deletions

View File

@@ -87,6 +87,8 @@ def GetDefaultGateway():
for line in lines:
words = line.split()
print words
if not words:
continue
if words[0] == '0.0.0.0':
gateway = words[1]
break
@@ -145,6 +147,12 @@ class Interface(object):
"""
self.iface = str(iface)
def _client_found(self, client):
output = misc.Run("which " + client)
if output and not ("no " + client) in output:
return True
return False
def CheckDHCP(self):
""" Check for a valid DHCP client.
@@ -158,9 +166,10 @@ class Interface(object):
if self.DHCP_CLIENT:
DHCP_CLIENT = self.DHCP_CLIENT
else:
DHCP_CLIENT = None
dhcpclients = ["dhclient", "dhcpcd", "pump"]
for client in dhcpclients:
if misc.Run("which " + client):
if self._client_found(client):
DHCP_CLIENT = client
break
@@ -187,12 +196,12 @@ class Interface(object):
def CheckWiredTools(self):
""" Check for the existence of ethtool and mii-tool. """
if misc.Run("which mii-tool"):
if self._client_found("mii-tool"):
self.MIITOOL_FOUND = True
else:
self.MIITOOL_FOUND = False
if misc.Run("which ethtool"):
if self._client_found("ethtool"):
self.ETHTOOL_FOUND = True
else:
self.ETHTOOL_FOUND = False
@@ -203,7 +212,7 @@ class Interface(object):
self.CheckDHCP()
self.CheckWiredTools()
if misc.Run("which ip"):
if self._client_found("ip"):
self.IP_FOUND = True
else:
self.IP_FOUND = False