mirror of
https://github.com/gryf/wicd.git
synced 2026-03-04 23:55:46 +01:00
Merge in rworkman-experimental
This commit is contained in:
0
encryption/templates/peap-tkip
Executable file → Normal file
0
encryption/templates/peap-tkip
Executable file → Normal file
@@ -2,20 +2,29 @@
|
|||||||
|
|
||||||
# pm-utils hook to handle suspend/resume properly for wicd
|
# pm-utils hook to handle suspend/resume properly for wicd
|
||||||
|
|
||||||
. "${PM_FUNCTIONS}" || . "${FUNCTIONS}"
|
if [ -r "${PM_FUNCTIONS}" ]; then
|
||||||
|
. "${PM_FUNCTIONS}"
|
||||||
|
elif [ -r "${FUNCTIONS}" ]; then
|
||||||
|
. "${FUNCTIONS}"
|
||||||
|
else
|
||||||
|
# pm-utils version is too old, or something else is wrong
|
||||||
|
exit $NA
|
||||||
|
fi
|
||||||
|
|
||||||
|
RETVAL=0 # Set this to 0 initially
|
||||||
|
|
||||||
wicd_suspend()
|
wicd_suspend()
|
||||||
{
|
{
|
||||||
# Put wifi interface down
|
# Put wifi interface down
|
||||||
%LIB%suspend.py 2>/dev/null
|
%LIB%suspend.py 1>/dev/null 2>/dev/null
|
||||||
return $NA
|
RETVAL=$?
|
||||||
}
|
}
|
||||||
|
|
||||||
wicd_resume()
|
wicd_resume()
|
||||||
{
|
{
|
||||||
# Bring wifi interface back up
|
# Bring wifi interface back up
|
||||||
%LIB%autoconnect.py 2>/dev/null
|
%LIB%autoconnect.py 1>/dev/null 2>/dev/null
|
||||||
return $NA
|
RETVAL=$?
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@@ -29,3 +38,32 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# We can't return a nonzero exit code (aside from $NA, $DX, and $NX) to
|
||||||
|
# to pm-utils or the entire sleep operation will be inhibited, so...
|
||||||
|
# No matter what we do, the log prefix and message will conflict a bit.
|
||||||
|
case "$RETVAL" in
|
||||||
|
0)
|
||||||
|
exit $RETVAL
|
||||||
|
;;
|
||||||
|
1)
|
||||||
|
# Probably the daemon isn't running if this happens
|
||||||
|
echo "Unable to connect to wicd daemon - is it running?"
|
||||||
|
exit $DX
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
# This will occur if the daemon encounters an error
|
||||||
|
echo "Wicd daemon was unable to suspend the network."
|
||||||
|
exit $DX
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
# Will only be returned by autoconnect.py
|
||||||
|
# This should never happen, but just in case...
|
||||||
|
echo "Wicd daemon failed to autoconnect on resume."
|
||||||
|
exit $DX
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown exit code."
|
||||||
|
exit $NA
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|||||||
12
other/wicd.conf → in/other=wicd.conf.in
Executable file → Normal file
12
other/wicd.conf → in/other=wicd.conf.in
Executable file → Normal file
@@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||||
<busconfig>
|
<busconfig>
|
||||||
|
|
||||||
<policy user="root">
|
<policy user="root">
|
||||||
<allow own="org.wicd.daemon"/>
|
<allow own="org.wicd.daemon"/>
|
||||||
<allow send_destination="org.wicd.daemon"/>
|
<allow send_destination="org.wicd.daemon"/>
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
<allow send_destination="org.wicd.daemon.config"/>
|
<allow send_destination="org.wicd.daemon.config"/>
|
||||||
<allow send_interface="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"/>
|
||||||
@@ -22,8 +24,18 @@
|
|||||||
<allow send_interface="org.wicd.daemon.wired"/>
|
<allow send_interface="org.wicd.daemon.wired"/>
|
||||||
<allow send_destination="org.wicd.daemon.config"/>
|
<allow send_destination="org.wicd.daemon.config"/>
|
||||||
<allow send_interface="org.wicd.daemon.config"/>
|
<allow send_interface="org.wicd.daemon.config"/>
|
||||||
|
<allow send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
<policy context="default">
|
<policy context="default">
|
||||||
<deny own="org.wicd.daemon"/>
|
<deny own="org.wicd.daemon"/>
|
||||||
</policy>
|
</policy>
|
||||||
|
|
||||||
|
<!-- This Unix group will have permission to use Wicd's gui -->
|
||||||
|
<policy group="%WICDGROUP%">
|
||||||
|
<allow send_interface="org.freedesktop.DBus.Introspectable"/>
|
||||||
|
<allow send_destination="org.wicd.daemon"/>
|
||||||
|
<allow send_interface="org.wicd.daemon"/>
|
||||||
|
</policy>
|
||||||
|
|
||||||
</busconfig>
|
</busconfig>
|
||||||
@@ -55,6 +55,7 @@ pidfile = '%PIDFILE%'
|
|||||||
initfile = '%INITFILE%'
|
initfile = '%INITFILE%'
|
||||||
# stores only the file name, i.e. wicd
|
# stores only the file name, i.e. wicd
|
||||||
initfilename = '%INITFILENAME%'
|
initfilename = '%INITFILENAME%'
|
||||||
|
wicd_group = '%WICDGROUP%'
|
||||||
|
|
||||||
# BOOLEANS
|
# BOOLEANS
|
||||||
no_install_pmutils = %NO_INSTALL_PMUTILS%
|
no_install_pmutils = %NO_INSTALL_PMUTILS%
|
||||||
|
|||||||
72
setup.py
72
setup.py
@@ -20,6 +20,7 @@ from distutils.extension import Extension
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
# Be sure to keep this updated!
|
# Be sure to keep this updated!
|
||||||
# VERSIONNUMBER
|
# VERSIONNUMBER
|
||||||
@@ -41,21 +42,9 @@ except Exception, e:
|
|||||||
class configure(Command):
|
class configure(Command):
|
||||||
description = "configure the paths that Wicd will be installed to"
|
description = "configure the paths that Wicd will be installed to"
|
||||||
|
|
||||||
# lib = '/usr/share/wicd/'
|
|
||||||
# etc = '/etc/wicd/'
|
|
||||||
# images = '/usr/share/pixmaps/wicd/'
|
|
||||||
# encryption = etc + 'encryption/templates/'
|
|
||||||
# bin = current
|
|
||||||
# networks = '/var/lib/wicd/configurations/'
|
|
||||||
# log = '/var/log/wicd/'
|
|
||||||
#
|
|
||||||
# python = '/usr/bin/python'
|
|
||||||
|
|
||||||
user_options = [
|
user_options = [
|
||||||
# these first bunch are DIRECTORIES.
|
# The first bunch is DIRECTORIES - they need to end with a slash ("/"),
|
||||||
# they need to end a slash ("/")
|
# which will automatically be tacked on in the finalize_options method
|
||||||
# which will automatically be tacked on
|
|
||||||
# in the finalize_options method
|
|
||||||
('lib=', None, 'set the lib directory'),
|
('lib=', None, 'set the lib directory'),
|
||||||
('share=', None, 'set the share directory'),
|
('share=', None, 'set the share directory'),
|
||||||
('etc=', None, 'set the etc directory'),
|
('etc=', None, 'set the etc directory'),
|
||||||
@@ -72,7 +61,6 @@ class configure(Command):
|
|||||||
('dbus=', None, 'set the directory the dbus config file is stored in'),
|
('dbus=', None, 'set the directory the dbus config file is stored in'),
|
||||||
('desktop=', None, 'set the directory the .desktop file is stored in'),
|
('desktop=', None, 'set the directory the .desktop file is stored in'),
|
||||||
('icons=', None, "set the base directory for the .desktop file's icons"),
|
('icons=', None, "set the base directory for the .desktop file's icons"),
|
||||||
# ('pixmaps=', None, 'directory for images'),
|
|
||||||
('translations=', None, 'set the directory translations are stored in'),
|
('translations=', None, 'set the directory translations are stored in'),
|
||||||
('autostart=', None, 'set the directory that will be autostarted on desktop login'),
|
('autostart=', None, 'set the directory that will be autostarted on desktop login'),
|
||||||
('init=', None, 'set the directory for the init file'),
|
('init=', None, 'set the directory for the init file'),
|
||||||
@@ -80,17 +68,17 @@ class configure(Command):
|
|||||||
('mandir=', None, 'set the directory for the man pages'),
|
('mandir=', None, 'set the directory for the man pages'),
|
||||||
('kdedir=', None, 'set the kde autostart directory'),
|
('kdedir=', None, 'set the kde autostart directory'),
|
||||||
|
|
||||||
# anything after here is a FILE.
|
# Anything after this is a FILE; in other words, a slash ("/") will
|
||||||
# in other words, a slash ("/") will not automatically
|
# not automatically be added to the end of the path.
|
||||||
# be added to the end of the path.
|
# Do NOT remove the python= entry, as it signals the beginning of
|
||||||
# do NOT remove the python= entry as it signals the beginning
|
# the file section.
|
||||||
# of the file section.
|
|
||||||
('python=', None, 'set the path to the Python executable'),
|
('python=', None, 'set the path to the Python executable'),
|
||||||
('pidfile=', None, 'set the pid file'),
|
('pidfile=', None, 'set the pid file'),
|
||||||
('initfile=', None, 'set the init file to use'),
|
('initfile=', None, 'set the init file to use'),
|
||||||
('initfilename=', None, "set the name of the init file (don't use)"),
|
('initfilename=', None, "set the name of the init file (don't use)"),
|
||||||
|
('wicdgroup=', None, "set the name of the group used for wicd"),
|
||||||
|
|
||||||
# switches
|
# Configure switches
|
||||||
('no-install-init', None, "do not install the init file"),
|
('no-install-init', None, "do not install the init file"),
|
||||||
('no-install-man', None, 'do not install the man file'),
|
('no-install-man', None, 'do not install the man file'),
|
||||||
('no-install-kde', None, 'do not install the kde autostart file'),
|
('no-install-kde', None, 'do not install the kde autostart file'),
|
||||||
@@ -130,8 +118,7 @@ class configure(Command):
|
|||||||
self.no_install_pmutils = False
|
self.no_install_pmutils = False
|
||||||
self.no_install_docs = False
|
self.no_install_docs = False
|
||||||
|
|
||||||
# figure out what the default init file
|
# Determine the default init file location on several different distros
|
||||||
# location should be on several different distros
|
|
||||||
|
|
||||||
self.distro_detect_failed = False
|
self.distro_detect_failed = False
|
||||||
|
|
||||||
@@ -173,9 +160,46 @@ class configure(Command):
|
|||||||
'If you have specified --init and --initfile, configure will continue. ' + \
|
'If you have specified --init and --initfile, configure will continue. ' + \
|
||||||
'Please report this warning, along with the name of your ' + \
|
'Please report this warning, along with the name of your ' + \
|
||||||
'distribution, to the wicd developers.'
|
'distribution, to the wicd developers.'
|
||||||
|
|
||||||
|
# Try to get the pm-utils sleep hooks directory from pkg-config and
|
||||||
|
# the kde prefix from kde-config
|
||||||
|
# Don't run these in a shell because it's not needed and because shell
|
||||||
|
# swallows the OSError we would get if {pkg,kde}-config do not exist
|
||||||
|
# If we don't get anything from *-config, or it didn't run properly,
|
||||||
|
# or the path is not a proper absolute path, raise an error
|
||||||
|
try:
|
||||||
|
pmtemp = subprocess.Popen(["pkg-config","--variable=pm_sleephooks","pm-utils"], stdout=subprocess.PIPE)
|
||||||
|
returncode = pmtemp.wait() # let it finish, and get the exit code
|
||||||
|
pmutils_candidate = pmtemp.stdout.readline().strip() # read stdout
|
||||||
|
if len(pmutils_candidate) == 0 or returncode != 0 or not os.path.isabs(pmutils_candidate):
|
||||||
|
raise ValueError
|
||||||
|
else:
|
||||||
|
self.pmutils = pmutils_candidate
|
||||||
|
except (OSError, ValueError):
|
||||||
|
pass # use our default
|
||||||
|
|
||||||
|
try:
|
||||||
|
kdetemp = subprocess.Popen(["kde-config","--prefix"], stdout=subprocess.PIPE)
|
||||||
|
returncode = kdetemp.wait() # let it finish, and get the exit code
|
||||||
|
kdedir_candidate = kdetemp.stdout.readline().strip() # read stdout
|
||||||
|
if len(kdedir_candidate) == 0 or returncode != 0 or not os.path.isabs(kdedir_candidate):
|
||||||
|
raise ValueError
|
||||||
|
else:
|
||||||
|
self.kdedir = kdedir_candidate + '/share/autostart'
|
||||||
|
except (OSError, ValueError):
|
||||||
|
# If kde-config isn't present or returns an error, then we can
|
||||||
|
# assume that kde isn't installed on the user's system
|
||||||
|
self.no_install_kde = True
|
||||||
|
# If it turns out that the assumption above is wrong, then we'll
|
||||||
|
# do this instead:
|
||||||
|
#pass # use our default
|
||||||
|
|
||||||
|
|
||||||
self.python = '/usr/bin/python'
|
self.python = '/usr/bin/python'
|
||||||
self.pidfile = '/var/run/wicd/wicd.pid'
|
self.pidfile = '/var/run/wicd/wicd.pid'
|
||||||
self.initfilename = os.path.basename(self.initfile)
|
self.initfilename = os.path.basename(self.initfile)
|
||||||
|
self.wicdgroup = 'users'
|
||||||
|
|
||||||
|
|
||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
if self.distro_detect_failed == True:
|
if self.distro_detect_failed == True:
|
||||||
@@ -373,7 +397,7 @@ try:
|
|||||||
piddir += '/'
|
piddir += '/'
|
||||||
data.append (( piddir, [] ))
|
data.append (( piddir, [] ))
|
||||||
if not wpath.no_install_docs:
|
if not wpath.no_install_docs:
|
||||||
data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README' ]))
|
data.append(( wpath.docdir, [ 'INSTALL', 'LICENSE', 'AUTHORS', 'README', 'CHANGES' ]))
|
||||||
if not wpath.no_install_kde:
|
if not wpath.no_install_kde:
|
||||||
data.append(( wpath.kdedir, [ 'other/wicd-tray.desktop' ]))
|
data.append(( wpath.kdedir, [ 'other/wicd-tray.desktop' ]))
|
||||||
if not wpath.no_install_init:
|
if not wpath.no_install_init:
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@@ -21,22 +21,37 @@ import dbus
|
|||||||
import time
|
import time
|
||||||
import gobject
|
import gobject
|
||||||
import sys
|
import sys
|
||||||
from dbus.mainloop.glib import DBusGMainLoop
|
|
||||||
|
|
||||||
DBusGMainLoop(set_as_default=True)
|
if getattr(dbus, 'version', (0, 0, 0)) < (0, 80, 0):
|
||||||
bus = dbus.SystemBus()
|
import dbus.glib
|
||||||
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
else:
|
||||||
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
from dbus.mainloop.glib import DBusGMainLoop
|
||||||
loop = gobject.MainLoop()
|
DBusGMainLoop(set_as_default=True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
bus = dbus.SystemBus()
|
||||||
|
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
||||||
|
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
||||||
|
except Exception, e:
|
||||||
|
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||||
|
print>>sys.stderr, 'Could not connect to daemon.'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def handler(*args):
|
def handler(*args):
|
||||||
loop.quit()
|
loop.quit()
|
||||||
|
|
||||||
print daemon.Hello()
|
def error_handler(*args):
|
||||||
time.sleep(3)
|
print>>sys.stderr, 'Async error autoconnecting.'
|
||||||
daemon.SetSuspend(False)
|
sys.exit(3)
|
||||||
if not daemon.CheckIfConnecting():
|
|
||||||
daemon.SetForcedDisconnect(False)
|
|
||||||
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
try:
|
||||||
|
time.sleep(3)
|
||||||
|
daemon.SetSuspend(False)
|
||||||
|
if not daemon.CheckIfConnecting():
|
||||||
|
daemon.SetForcedDisconnect(False)
|
||||||
|
daemon.AutoConnect(True, reply_handler=handler, error_handler=handler)
|
||||||
|
except Exception, e:
|
||||||
|
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||||
|
print>>sys.stderr, 'Error autoconnecting.'
|
||||||
|
sys.exit(2)
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ Used for when a laptop enters hibernation/suspension.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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
|
||||||
@@ -26,13 +26,17 @@ Used for when a laptop enters hibernation/suspension.
|
|||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bus = dbus.SystemBus()
|
bus = dbus.SystemBus()
|
||||||
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
proxy_obj = bus.get_object('org.wicd.daemon', '/org/wicd/daemon')
|
||||||
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
daemon = dbus.Interface(proxy_obj, 'org.wicd.daemon')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "Exception caught: %s" % str(e)
|
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||||
|
print>>sys.stderr, 'Could not connect to daemon.'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
@@ -41,5 +45,7 @@ if __name__ == '__main__':
|
|||||||
daemon.SetForcedDisconnect(False)
|
daemon.SetForcedDisconnect(False)
|
||||||
daemon.SetSuspend(True)
|
daemon.SetSuspend(True)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "Exception caught: %s" % str(e)
|
print>>sys.stderr, "Exception caught: %s" % str(e)
|
||||||
|
print>>sys.stderr, 'Error setting suspend.'
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user