[wicd/f15] Correct systemd unit file for wicd, add D-Bus service file (#699116) Move docs to the wicd-common su
David Cantrell
dcantrel at fedoraproject.org
Thu Aug 11 21:12:40 UTC 2011
commit bd5839e538f00f4b3024805cecd924b53ddc3645
Author: David Cantrell <david.l.cantrell at gmail.com>
Date: Thu Aug 11 17:05:39 2011 -0400
Correct systemd unit file for wicd, add D-Bus service file (#699116)
Move docs to the wicd-common subpackage
Correct /etc/dbus-1/system.d/wicd.conf (#699116)
org.wicd.daemon.service | 11 ++++++++
wicd-1.7.0-dbus-failure.patch | 50 ++++++++++++++++++++++++++++++++++++
wicd-1.7.0-dbus-policy.patch | 54 +++++++++++++++++++++++++++++++++++++++
wicd-1.7.0-error-messages.patch | 27 +++++++++++++++++++
wicd.service | 10 +++++--
wicd.spec | 27 ++++++++++++++++++-
6 files changed, 174 insertions(+), 5 deletions(-)
---
diff --git a/org.wicd.daemon.service b/org.wicd.daemon.service
new file mode 100644
index 0000000..b0287f3
--- /dev/null
+++ b/org.wicd.daemon.service
@@ -0,0 +1,11 @@
+# This D-Bus service activation file is only for systemd support since
+# an auto-activated wicd would be quite surprising for those people
+# who have wicd installed but turned off. Thus the Exec path available to
+# D-Bus is /bin/false, but systemd knows the real Exec path due to the
+# wicd systemd .service file.
+
+[D-BUS Service]
+Name=org.wicd.daemon
+Exec=/bin/false
+User=root
+SystemdService=dbus-org.wicd.daemon.service
diff --git a/wicd-1.7.0-dbus-failure.patch b/wicd-1.7.0-dbus-failure.patch
new file mode 100644
index 0000000..3d2eacf
--- /dev/null
+++ b/wicd-1.7.0-dbus-failure.patch
@@ -0,0 +1,50 @@
+diff -up wicd-1.7.0/cli/wicd-cli.py.orig wicd-1.7.0/cli/wicd-cli.py
+--- wicd-1.7.0/cli/wicd-cli.py.orig 2010-01-14 23:49:11.000000000 -0500
++++ wicd-1.7.0/cli/wicd-cli.py 2011-08-05 11:09:57.561058338 -0400
+@@ -43,6 +43,10 @@ except dbus.DBusException:
+ print 'Error: Could not connect to the daemon. Please make sure it is running.'
+ sys.exit(3)
+
++if daemon is None:
++ print 'Error connecting to wicd via D-Bus. Please make sure the wicd service is running.'
++ sys.exit(3)
++
+ parser = optparse.OptionParser()
+
+ parser.add_option('--network', '-n', type='int', default=-1)
+diff -up wicd-1.7.0/curses/wicd-curses.py.orig wicd-1.7.0/curses/wicd-curses.py
+--- wicd-1.7.0/curses/wicd-curses.py.orig 2010-01-14 23:49:11.000000000 -0500
++++ wicd-1.7.0/curses/wicd-curses.py 2011-08-05 11:09:00.248056606 -0400
+@@ -1016,6 +1016,10 @@ def setup_dbus(force=True):
+ wireless = dbus_ifaces['wireless']
+ wired = dbus_ifaces['wired']
+
++ if daemon is None:
++ print 'Error connecting to wicd via D-Bus. Please make sure the wicd service is running.'
++ sys.exit(3)
++
+ netentry_curses.dbus_init(dbus_ifaces)
+ return True
+
+diff -up wicd-1.7.0/gtk/gui.py.orig wicd-1.7.0/gtk/gui.py
+--- wicd-1.7.0/gtk/gui.py.orig 2010-01-14 23:49:11.000000000 -0500
++++ wicd-1.7.0/gtk/gui.py 2011-08-05 10:49:08.392177338 -0400
+@@ -146,6 +146,17 @@ class appGui(object):
+ """ Initializes everything needed for the GUI. """
+ setup_dbus()
+
++ if daemon is None:
++ errmsg = "Error connecting to wicd service via D-Bus." + \
++ "Please ensure the wicd service is running."
++ d = gtk.MessageDialog(parent=None,
++ flags=gtk.DIALOG_MODAL,
++ type=gtk.MESSAGE_ERROR,
++ buttons=gtk.BUTTONS_OK,
++ message_format=errmsg)
++ d.run()
++ sys.exit(1)
++
+ self.tray = tray
+
+ gladefile = os.path.join(wpath.gtk, "wicd.glade")
+diff -up wicd-1.7.0/gtk/wicd-client.py.orig wicd-1.7.0/gtk/wicd-client.py
diff --git a/wicd-1.7.0-dbus-policy.patch b/wicd-1.7.0-dbus-policy.patch
new file mode 100644
index 0000000..9b722ec
--- /dev/null
+++ b/wicd-1.7.0-dbus-policy.patch
@@ -0,0 +1,54 @@
+diff -up wicd-1.7.0/in/other=wicd.conf.in.orig wicd-1.7.0/in/other=wicd.conf.in
+--- wicd-1.7.0/in/other=wicd.conf.in.orig 2010-01-14 23:49:11.000000000 -0500
++++ wicd-1.7.0/in/other=wicd.conf.in 2011-08-11 16:57:20.818332542 -0400
+@@ -7,41 +7,24 @@
+ <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.wireless"/>
++ <allow send_interface="org.wicd.daemon.wireless"/>
++ <allow send_destination="org.wicd.daemon.wired"/>
++ <allow send_interface="org.wicd.daemon.wired"/>
+ </policy>
+
+ <policy context="default">
+ <deny own="org.wicd.daemon"/>
+ </policy>
+
+- <!-- This Unix group will have permission to use Wicd's gui -->
+- <policy group="%WICDGROUP%">
+- <allow send_destination="org.wicd.daemon"/>
+- <allow send_interface="org.wicd.daemon"/>
+- <allow send_interface="org.freedesktop.DBus.Introspectable"/>
+- <!-- The Introspectable allow shouldn't be needed here, but
+- it seems that a few distributions aren't yet allowing
+- it in their hal configs, and we need it here, so... -->
+- </policy>
+-
+- <!-- Comment the block below if you do not want all users logged in
+- locally to have permission to use wicd-client. This ignores the
+- group based permission model defined above for the "%WICDGROUP%"
+- group. Note that this only applies if you are using ConsoleKit -
+- if you do not have ConsoleKit installed and in use, then this
+- block makes no difference either way. -->
+-
+ <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_interface="org.freedesktop.DBus.Introspectable"/>
++ <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_interface="org.freedesktop.DBus.Introspectable"/>
+ </policy>
+
+ </busconfig>
diff --git a/wicd-1.7.0-error-messages.patch b/wicd-1.7.0-error-messages.patch
new file mode 100644
index 0000000..1de0cc8
--- /dev/null
+++ b/wicd-1.7.0-error-messages.patch
@@ -0,0 +1,27 @@
+diff -up wicd-1.7.0/curses/wicd-curses.py.orig wicd-1.7.0/curses/wicd-curses.py
+--- wicd-1.7.0/curses/wicd-curses.py.orig 2011-08-11 17:01:29.969340068 -0400
++++ wicd-1.7.0/curses/wicd-curses.py 2011-08-11 17:01:30.159340092 -0400
+@@ -1033,7 +1033,7 @@ if __name__ == '__main__':
+ parser = OptionParser(version="wicd-curses-%s (using wicd %s)" % (CURSES_REV,daemon.Hello()))
+ except Exception, e:
+ if "DBus.Error.AccessDenied" in e.get_dbus_name():
+- print language['access_denied_wc'].replace('$A','\033[1;34m'+wpath.wicd_group+'\033[0m')
++ print language['access_denied_wc']
+ sys.exit(1)
+ else:
+ raise
+diff -up wicd-1.7.0/wicd/translations.py.orig wicd-1.7.0/wicd/translations.py
+--- wicd-1.7.0/wicd/translations.py.orig 2010-01-14 23:49:23.000000000 -0500
++++ wicd-1.7.0/wicd/translations.py 2011-08-11 17:01:30.179340042 -0400
+@@ -214,9 +214,9 @@ language['connection_established'] = _('
+ language['disconnected'] = _('''Disconnected''')
+ language['establishing_connection'] = _('''Establishing connection...''')
+ language['association_failed'] = _('''Connection failed: Could not contact the wireless access point.''')
+-language['access_denied'] = _('''Unable to contact the Wicd daemon due to an access denied error from DBus. Please check that your user is in the $A group.''')
++language['access_denied'] = _('''Unable to contact the Wicd daemon due to an access denied error from DBus. Please check your D-Bus policy configuration.''')
+ language['disconnecting_active'] = _('''Disconnecting active connections...''')
+-language['access_denied_wc'] = _('''ERROR: wicd-curses was denied access to the wicd daemon: please check that your user is in the "$A" group.''')
++language['access_denied_wc'] = _('''ERROR: wicd-curses was denied access to the wicd daemon: please check your D-Bus policy configuration.''')
+ language['post_disconnect_script'] = _('''Run post-disconnect script''')
+ language['resume_script'] = _('''Resume script''')
+ language['suspend_script'] = _('''Suspend script''')
diff --git a/wicd.service b/wicd.service
index f30fc3a..68d2437 100644
--- a/wicd.service
+++ b/wicd.service
@@ -1,11 +1,15 @@
[Unit]
Description=Wicd a wireless and wired network manager for Linux
After=syslog.target
+Wants=network.target
+Before=network.target
+Conflicts=NetworkManager.service
[Service]
-Type=forking
-ExecStart=/usr/sbin/wicd
-ExecStop=/usr/sbin/wicd -k
+Type=dbus
+BusName=org.wicd.daemon
+ExecStart=/usr/sbin/wicd --no-daemon
[Install]
WantedBy=multi-user.target
+Alias=dbus-org.wicd.daemon.service
diff --git a/wicd.spec b/wicd.spec
index 457462c..dd7beb0 100644
--- a/wicd.spec
+++ b/wicd.spec
@@ -9,7 +9,7 @@
Name: wicd
Version: 1.7.0
-Release: 8%{?dist}
+Release: 9%{?dist}
Summary: Wireless and wired network connection manager
Group: System Environment/Base
@@ -18,8 +18,13 @@ URL: http://wicd.sourceforge.net/
Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Source1: wicd.logrotate
Source2: wicd.service
+Source3: org.wicd.daemon.service
+
Patch0: wicd-1.7.0-remove-WHEREAREMYFILES.patch
Patch1: wicd-1.7.0-deepcopy.patch
+Patch2: wicd-1.7.0-dbus-failure.patch
+Patch3: wicd-1.7.0-error-messages.patch
+Patch4: wicd-1.7.0-dbus-policy.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
BuildRequires: python2-devel
@@ -90,6 +95,15 @@ Client program for wicd that uses a GTK+ interface.
# Use cPickle instead of deepcopy in configmanager.py
%patch1 -p1
+# Handle D-Bus connection failures a little better
+%patch2 -p1
+
+# Direct users to D-Bus policy configuration on connection failure
+%patch3 -p1
+
+# Allow users at the console to control wicd
+%patch4 -p1
+
%build
# NOTE: --etc is where dhclient.conf.template goes
%{__python} setup.py configure \
@@ -136,6 +150,9 @@ install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/wicd
mkdir -p %{buildroot}%{_systemd_unitdir}
install -m 0644 %{SOURCE2} %{buildroot}%{_systemd_unitdir}/wicd.service
+mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
+install -m 0644 %{SOURCE3} %{buildroot}%{_datadir}/dbus-1/system-services/org.wicd.daemon.service
+
desktop-file-install \
--remove-category="Application" \
--delete-original \
@@ -190,11 +207,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
%defattr(-,root,root,-)
-%doc AUTHORS CHANGES LICENSE NEWS README other/WHEREAREMYFILES
%{_libdir}/pm-utils/sleep.d/91wicd
%files common -f %{name}.lang
%defattr(-,root,root,-)
+%doc AUTHORS CHANGES LICENSE NEWS README other/WHEREAREMYFILES
%dir %{python_sitelib}/wicd
%dir %{_sysconfdir}/wicd
%dir %{_sysconfdir}/wicd/encryption
@@ -228,6 +245,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_bindir}/wicd-client
%{_sbindir}/wicd
%{_datadir}/applications/wicd.desktop
+%{_datadir}/dbus-1/system-services/org.wicd.daemon.service
%{_datadir}/man/man1/wicd-client.1*
%{_datadir}/man/man5/wicd-manager-settings.conf.5*
%{_datadir}/man/man5/wicd-wired-settings.conf.5*
@@ -270,6 +288,11 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_datadir}/icons/hicolor/scalable/apps/wicd-gtk.svg
%changelog
+* Thu Aug 11 2011 David Cantrell <dcantrell at redhat.com> - 1.7.0-9
+- Correct systemd unit file for wicd, add D-Bus service file (#699116)
+- Move docs to the wicd-common subpackage
+- Correct /etc/dbus-1/system.d/wicd.conf (#699116)
+
* Mon May 09 2011 Bill Nottingham <notting at redhat.com> - 1.7.0-8
- fix systemd scriptlets for upgrade
More information about the scm-commits
mailing list