mirror of
https://github.com/gryf/wicd.git
synced 2025-12-23 06:37:59 +01:00
experimental:
- Add UPDATE_INTERVAL as a required attribute for backends, and used by monitor.py - Update Copyright stuff in a few files - Remove/update some scripts and configuration files.
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Bring wifi network interface back up.
|
|
||||||
/opt/wicd/suspend.py
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# Bring wifi network interface back up.
|
|
||||||
|
|
||||||
/opt/wicd/autoconnect.py
|
|
||||||
@@ -1,19 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#stop daemon!
|
|
||||||
/etc/init.d/wicd stop
|
|
||||||
|
|
||||||
#remove because we changed stuff
|
# Stop daemon
|
||||||
update-rc.d -f wicd remove
|
if [ -f /etc/init.d/wicd ]; then
|
||||||
|
/etc/init.d/wicd stop
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove Wicd from the boot sequence
|
||||||
|
if which update-rc.d &>/dev/null ; then
|
||||||
|
update-rc.d -f wicd remove
|
||||||
|
fi
|
||||||
|
|
||||||
#remove pyc files that screw things up sometimes
|
# Remove pyc files
|
||||||
#there shouldn't be any there, but it never hurts to check
|
# They may exist if you are upgrading Wicd
|
||||||
#they may exist if you are upgrading wicd
|
rm -f /opt/wicd/*.pyc
|
||||||
rm -rf /opt/wicd/*.pyc
|
|
||||||
|
|
||||||
#add us to the startup
|
# Add Wicd to the startup sequence
|
||||||
#add us to 80 because sometimes dbus starts
|
# 80 to make sure that dbus is running when Wicd starts
|
||||||
#later then 20, so that causes problems
|
if which update-rc.d &>/dev/null ; then
|
||||||
update-rc.d wicd start 80 2 3 4 5 . stop 20 0 1 6 .
|
update-rc.d wicd start 80 2 3 4 5 . stop 20 0 1 6 .
|
||||||
|
fi
|
||||||
|
|
||||||
#start the daemon
|
# Start the daemon
|
||||||
/etc/init.d/wicd start
|
if [ -f /etc/init.d/wicd ]; then
|
||||||
|
/etc/init.d/wicd start
|
||||||
|
fi
|
||||||
|
|||||||
@@ -6,14 +6,32 @@
|
|||||||
<allow own="org.wicd.daemon"/>
|
<allow own="org.wicd.daemon"/>
|
||||||
<allow send_destination="org.wicd.daemon"/>
|
<allow send_destination="org.wicd.daemon"/>
|
||||||
<allow send_interface="org.wicd.daemon"/>
|
<allow send_interface="org.wicd.daemon"/>
|
||||||
|
<allow send_destination="org.wicd.daemon.wireless"/>
|
||||||
|
<allow send_interface="org.wicd.daemon.wireless"/>
|
||||||
|
<allow send_destination="org.wicd.daemon.wired"/>
|
||||||
|
<allow send_interface="org.wicd.daemon.wired"/>
|
||||||
|
<allow send_destination="org.wicd.daemon.config"/>
|
||||||
|
<allow send_interface="org.wicd.daemon.config"/>
|
||||||
</policy>
|
</policy>
|
||||||
<policy at_console="true">
|
<policy at_console="true">
|
||||||
<allow send_destination="org.wicd.daemon"/>
|
<allow send_destination="org.wicd.daemon"/>
|
||||||
<allow send_interface="org.wicd.daemon"/>
|
<allow send_interface="org.wicd.daemon"/>
|
||||||
|
<allow send_destination="org.wicd.daemon.wireless"/>
|
||||||
|
<allow send_interface="org.wicd.daemon.wireless"/>
|
||||||
|
<allow send_destination="org.wicd.daemon.wired"/>
|
||||||
|
<allow send_interface="org.wicd.daemon.wired"/>
|
||||||
|
<allow send_destination="org.wicd.daemon.config"/>
|
||||||
|
<allow send_interface="org.wicd.daemon.config"/>
|
||||||
</policy>
|
</policy>
|
||||||
<policy context="default">
|
<policy context="default">
|
||||||
<allow own="org.wicd.daemon"/>
|
<deny own="org.wicd.daemon"/>
|
||||||
<allow send_destination="org.wicd.daemon"/>
|
<deny send_destination="org.wicd.daemon"/>
|
||||||
<allow send_interface="org.wicd.daemon"/>
|
<deny send_interface="org.wicd.daemon"/>
|
||||||
|
<deny send_destination="org.wicd.daemon.wireless"/>
|
||||||
|
<deny send_interface="org.wicd.daemon.wireless"/>
|
||||||
|
<deny send_destination="org.wicd.daemon.wired"/>
|
||||||
|
<deny send_interface="org.wicd.daemon.wired"/>
|
||||||
|
<deny send_destination="org.wicd.daemon.config"/>
|
||||||
|
<deny send_interface="org.wicd.daemon.config"/>
|
||||||
</policy>
|
</policy>
|
||||||
</busconfig>
|
</busconfig>
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
/usr/lib/wicd/wicd-daemon.py $@
|
exec /usr/lib/wicd/wicd-daemon.py $@
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ Manages and loads the pluggable backends for wicd.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Adam Blackburn
|
# Copyright (C) 2008 Adam Blackburn
|
||||||
# Copyright (C) 2007 Dan O'Reilly
|
# Copyright (C) 2008 Dan O'Reilly
|
||||||
# Copyright (C) 2007 Byron Hillis
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License Version 2 as
|
# it under the terms of the GNU General Public License Version 2 as
|
||||||
@@ -44,7 +43,7 @@ class BackendManager(object):
|
|||||||
be_file.endswith(".py"))
|
be_file.endswith(".py"))
|
||||||
|
|
||||||
def get_current_backend(self):
|
def get_current_backend(self):
|
||||||
if self.__loaded_backend and not self.__loaded_backend is None:
|
if self.__loaded_backend:
|
||||||
return self.__loaded_backend.NAME
|
return self.__loaded_backend.NAME
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@@ -68,7 +67,9 @@ class BackendManager(object):
|
|||||||
"""
|
"""
|
||||||
def fail(backend_name, reason):
|
def fail(backend_name, reason):
|
||||||
print "Failed to load backend %s: %s" % (backend_name, reason)
|
print "Failed to load backend %s: %s" % (backend_name, reason)
|
||||||
|
return True
|
||||||
|
|
||||||
|
failed = False
|
||||||
print 'trying to load backend %s' % backend_name
|
print 'trying to load backend %s' % backend_name
|
||||||
backend_path = os.path.join(self.backend_dir,
|
backend_path = os.path.join(self.backend_dir,
|
||||||
'be-' + backend_name + '.py')
|
'be-' + backend_name + '.py')
|
||||||
@@ -80,15 +81,17 @@ class BackendManager(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if not backend.NAME:
|
if not backend.NAME:
|
||||||
fail(backend_name, 'Missing NAME declaration.')
|
failed = fail(backend_name, 'Missing NAME attribute.')
|
||||||
return None
|
if not backend.UPDATE_INTERVAL:
|
||||||
|
failed = fail(backend_name, "Missing UPDATE_INTERVAL attribute.")
|
||||||
|
if not backend.NeedsExternalCalls:
|
||||||
|
failed = fail(backend_name, "Missing NeedsExternalCalls method.")
|
||||||
if not backend.WiredInterface:
|
if not backend.WiredInterface:
|
||||||
fail(backend_name, "Missing WiredInterface class")
|
failed = fail(backend_name, "Missing WiredInterface class.")
|
||||||
return None
|
|
||||||
|
|
||||||
if not backend.WirelessInterface:
|
if not backend.WirelessInterface:
|
||||||
fail(backend_name, "Missing WirelessInterface class")
|
failed = fail(backend_name, "Missing WirelessInterface class.")
|
||||||
|
|
||||||
|
if failed:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
self.__loaded_backend = backend
|
self.__loaded_backend = backend
|
||||||
|
|||||||
@@ -14,9 +14,8 @@ class WirelessInterface() -- Control a wireless network interface.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Adam Blackburn
|
# Copyright (C) 2008 Adam Blackburn
|
||||||
# Copyright (C) 2007 Dan O'Reilly
|
# Copyright (C) 2008 Dan O'Reilly
|
||||||
# Copyright (C) 2007 Byron Hillis
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License Version 2 as
|
# it under the terms of the GNU General Public License Version 2 as
|
||||||
@@ -41,6 +40,7 @@ import time
|
|||||||
|
|
||||||
|
|
||||||
NAME = "external"
|
NAME = "external"
|
||||||
|
UPDATE_INTERVAL = 4
|
||||||
DESCRIPTION = """External app (slow) backend
|
DESCRIPTION = """External app (slow) backend
|
||||||
|
|
||||||
This backend uses external program calls like ifconfig and
|
This backend uses external program calls like ifconfig and
|
||||||
|
|||||||
@@ -15,9 +15,8 @@ class WirelessInterface() -- Control a wireless network interface.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Adam Blackburn
|
# Copyright (C) 2008 Adam Blackburn
|
||||||
# Copyright (C) 2007 Dan O'Reilly
|
# Copyright (C) 2008 Dan O'Reilly
|
||||||
# Copyright (C) 2007 Byron Hillis
|
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License Version 2 as
|
# it under the terms of the GNU General Public License Version 2 as
|
||||||
@@ -49,6 +48,7 @@ import array
|
|||||||
|
|
||||||
|
|
||||||
NAME = "ioctl"
|
NAME = "ioctl"
|
||||||
|
UPDATE_INTERVAL = 3
|
||||||
DESCRIPTION = """IOCTL (fast) backend
|
DESCRIPTION = """IOCTL (fast) backend
|
||||||
|
|
||||||
This backend uses IOCTL calls and python libraries to query
|
This backend uses IOCTL calls and python libraries to query
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ reusable for other purposes as well.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Adam Blackburn
|
# Copyright (C) 2008 Adam Blackburn
|
||||||
# Copyright (C) 2007 Dan O'Reilly
|
# Copyright (C) 2008 Dan O'Reilly
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License Version 2 as
|
# it under the terms of the GNU General Public License Version 2 as
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ run as the current user.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Adam Blackburn
|
# Copyright (C) 2007-2008 Adam Blackburn
|
||||||
# Copyright (C) 2007 Dan O'Reilly
|
# Copyright (C) 2007-2008 Dan O'Reilly
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License Version 2 as
|
# it under the terms of the GNU General Public License Version 2 as
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ A module for storing wicd's dbus interfaces.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# Copyright (C) 2007 Adam Blackburn
|
# Copyright (C) 2008 Adam Blackburn
|
||||||
# Copyright (C) 2007 Dan O'Reilly
|
# Copyright (C) 2008 Dan O'Reilly
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License Version 2 as
|
# it under the terms of the GNU General Public License Version 2 as
|
||||||
|
|||||||
@@ -289,10 +289,7 @@ def main():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
monitor = ConnectionStatus()
|
monitor = ConnectionStatus()
|
||||||
if daemon.GetCurrentBackend() == "ioctl":
|
to_time = daemon.GetBackendUpdateInterval()
|
||||||
to_time = 3
|
|
||||||
else:
|
|
||||||
to_time = 4
|
|
||||||
try:
|
try:
|
||||||
gobject.timeout_add_seconds(to_time, monitor.update_connection_status)
|
gobject.timeout_add_seconds(to_time, monitor.update_connection_status)
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ def get_backend_list():
|
|||||||
else:
|
else:
|
||||||
return BACKEND_MGR.get_available_backends()
|
return BACKEND_MGR.get_available_backends()
|
||||||
|
|
||||||
|
def get_backend_update_interval():
|
||||||
|
if not BACKEND_MGR:
|
||||||
|
return 4
|
||||||
|
else:
|
||||||
|
return BACKEND_MGR.UPDATE_INTERVAL
|
||||||
|
|
||||||
def get_current_backend():
|
def get_current_backend():
|
||||||
if not BACKEND_MGR:
|
if not BACKEND_MGR:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -193,6 +193,11 @@ class WicdDaemon(dbus.service.Object):
|
|||||||
""" Returns the currently loaded backend. """
|
""" Returns the currently loaded backend. """
|
||||||
return networking.get_current_backend()
|
return networking.get_current_backend()
|
||||||
|
|
||||||
|
@dbus.server.method('org.wicd.daemon')
|
||||||
|
def GetBackendUpdateInterval('org.wicd.daemon'):
|
||||||
|
""" Returns status update interval for the loaded backend. """
|
||||||
|
return networking.get_backend_update_interval()
|
||||||
|
|
||||||
@dbus.service.method('org.wicd.daemon')
|
@dbus.service.method('org.wicd.daemon')
|
||||||
def GetSavedBackend(self):
|
def GetSavedBackend(self):
|
||||||
""" Returns the backend saved to disk. """
|
""" Returns the backend saved to disk. """
|
||||||
|
|||||||
Reference in New Issue
Block a user