mirror of
https://github.com/gryf/wicd.git
synced 2025-12-19 20:38: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:
22
monitor.py
22
monitor.py
@@ -1,5 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
""" monitor -- connection monitoring process
|
||||
|
||||
This process is spawned as a child of the daemon, and is responsible
|
||||
for monitoring connection status and initiating autoreconnection
|
||||
when appropriate.
|
||||
|
||||
|
||||
"""
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
@@ -19,7 +27,6 @@
|
||||
|
||||
import dbus
|
||||
import gobject
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from dbus.mainloop.glib import DBusGMainLoop
|
||||
@@ -34,8 +41,8 @@ if sys.platform == 'linux2':
|
||||
libc = dl.open('/lib/libc.so.6')
|
||||
libc.call('prctl', 15, 'wicd-monitor\0', 0, 0, 0) # 15 is PR_SET_NAME
|
||||
except:
|
||||
pass
|
||||
|
||||
print 'Failed to set the process name'
|
||||
|
||||
if __name__ == '__main__':
|
||||
wpath.chdir(__file__)
|
||||
|
||||
@@ -244,13 +251,16 @@ class ConnectionStatus():
|
||||
self.reconnecting = False
|
||||
|
||||
def reply_handle():
|
||||
pass
|
||||
""" Just a dummy function needed for asynchronous dbus calls. """
|
||||
pass
|
||||
|
||||
def err_handle(e):
|
||||
pass
|
||||
def err_handle(error):
|
||||
""" Just a dummy function needed for asynchronous dbus calls. """
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
""" Start the connection monitor and set the updater to run every 2 sec. """
|
||||
monitor = ConnectionStatus()
|
||||
gobject.timeout_add(3000, monitor.update_connection_status)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user