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
|
||||
#stop daemon!
|
||||
/etc/init.d/wicd stop
|
||||
|
||||
#remove because we changed stuff
|
||||
update-rc.d -f wicd remove
|
||||
# Stop daemon
|
||||
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
|
||||
#there shouldn't be any there, but it never hurts to check
|
||||
#they may exist if you are upgrading wicd
|
||||
rm -rf /opt/wicd/*.pyc
|
||||
# Remove pyc files
|
||||
# They may exist if you are upgrading Wicd
|
||||
rm -f /opt/wicd/*.pyc
|
||||
|
||||
#add us to the startup
|
||||
#add us to 80 because sometimes dbus starts
|
||||
#later then 20, so that causes problems
|
||||
update-rc.d wicd start 80 2 3 4 5 . stop 20 0 1 6 .
|
||||
# Add Wicd to the startup sequence
|
||||
# 80 to make sure that dbus is running when Wicd starts
|
||||
if which update-rc.d &>/dev/null ; then
|
||||
update-rc.d wicd start 80 2 3 4 5 . stop 20 0 1 6 .
|
||||
fi
|
||||
|
||||
#start the daemon
|
||||
/etc/init.d/wicd start
|
||||
# Start the daemon
|
||||
if [ -f /etc/init.d/wicd ]; then
|
||||
/etc/init.d/wicd start
|
||||
fi
|
||||
|
||||
@@ -6,14 +6,32 @@
|
||||
<allow own="org.wicd.daemon"/>
|
||||
<allow send_destination="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 at_console="true">
|
||||
<allow send_destination="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 context="default">
|
||||
<allow own="org.wicd.daemon"/>
|
||||
<allow send_destination="org.wicd.daemon"/>
|
||||
<allow send_interface="org.wicd.daemon"/>
|
||||
<deny own="org.wicd.daemon"/>
|
||||
<deny send_destination="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>
|
||||
</busconfig>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/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) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 Byron Hillis
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# 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
|
||||
@@ -44,7 +43,7 @@ class BackendManager(object):
|
||||
be_file.endswith(".py"))
|
||||
|
||||
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
|
||||
else:
|
||||
return None
|
||||
@@ -68,7 +67,9 @@ class BackendManager(object):
|
||||
"""
|
||||
def fail(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
|
||||
backend_path = os.path.join(self.backend_dir,
|
||||
'be-' + backend_name + '.py')
|
||||
@@ -80,15 +81,17 @@ class BackendManager(object):
|
||||
return None
|
||||
|
||||
if not backend.NAME:
|
||||
fail(backend_name, 'Missing NAME declaration.')
|
||||
return None
|
||||
|
||||
failed = fail(backend_name, 'Missing NAME attribute.')
|
||||
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:
|
||||
fail(backend_name, "Missing WiredInterface class")
|
||||
return None
|
||||
|
||||
failed = fail(backend_name, "Missing WiredInterface class.")
|
||||
if not backend.WirelessInterface:
|
||||
fail(backend_name, "Missing WirelessInterface class")
|
||||
failed = fail(backend_name, "Missing WirelessInterface class.")
|
||||
|
||||
if failed:
|
||||
return None
|
||||
|
||||
self.__loaded_backend = backend
|
||||
|
||||
@@ -14,9 +14,8 @@ class WirelessInterface() -- Control a wireless network interface.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 Byron Hillis
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# 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
|
||||
@@ -41,6 +40,7 @@ import time
|
||||
|
||||
|
||||
NAME = "external"
|
||||
UPDATE_INTERVAL = 4
|
||||
DESCRIPTION = """External app (slow) backend
|
||||
|
||||
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) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007 Byron Hillis
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# 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
|
||||
@@ -49,6 +48,7 @@ import array
|
||||
|
||||
|
||||
NAME = "ioctl"
|
||||
UPDATE_INTERVAL = 3
|
||||
DESCRIPTION = """IOCTL (fast) backend
|
||||
|
||||
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) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# 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
|
||||
|
||||
@@ -10,8 +10,8 @@ run as the current user.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2007-2008 Adam Blackburn
|
||||
# Copyright (C) 2007-2008 Dan O'Reilly
|
||||
#
|
||||
# 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
|
||||
|
||||
@@ -7,8 +7,8 @@ A module for storing wicd's dbus interfaces.
|
||||
"""
|
||||
|
||||
#
|
||||
# Copyright (C) 2007 Adam Blackburn
|
||||
# Copyright (C) 2007 Dan O'Reilly
|
||||
# Copyright (C) 2008 Adam Blackburn
|
||||
# Copyright (C) 2008 Dan O'Reilly
|
||||
#
|
||||
# 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
|
||||
|
||||
@@ -289,10 +289,7 @@ def main():
|
||||
|
||||
"""
|
||||
monitor = ConnectionStatus()
|
||||
if daemon.GetCurrentBackend() == "ioctl":
|
||||
to_time = 3
|
||||
else:
|
||||
to_time = 4
|
||||
to_time = daemon.GetBackendUpdateInterval()
|
||||
try:
|
||||
gobject.timeout_add_seconds(to_time, monitor.update_connection_status)
|
||||
except:
|
||||
|
||||
@@ -63,6 +63,12 @@ def get_backend_list():
|
||||
else:
|
||||
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():
|
||||
if not BACKEND_MGR:
|
||||
return None
|
||||
|
||||
@@ -193,6 +193,11 @@ class WicdDaemon(dbus.service.Object):
|
||||
""" Returns the currently loaded 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')
|
||||
def GetSavedBackend(self):
|
||||
""" Returns the backend saved to disk. """
|
||||
|
||||
Reference in New Issue
Block a user