[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCHES] Add wicd and wicd-service
From: |
Mark H Weaver |
Subject: |
[PATCHES] Add wicd and wicd-service |
Date: |
Wed, 04 Feb 2015 03:59:40 -0500 |
Hello Guix,
This preliminary patch set adds wicd and wicd-service.
The first patch adds dbus support to wpa-supplicant, while preserving
the lightweight wpa-supplicant without dbus under a different name:
wpa-supplicant-light.
The second patch adds the wicd package, although there are still some
issues with it (see below).
The third patch adds wicd-service.
It mostly works, and I'm using it right now, but there are still some
remaining issues:
* Unless run as root, the user interfaces to configure wicd via dbus
always fail. The wicd dbus configuration file is supposed to allow
anyone in the 'netdev' group to access and configure the daemon, but
this doesn't work. I could use some help debugging this.
* The curses client always fails with the error "AttributeError:
'Screen' object has no attribute 'get_input_nonblocking'", which I
guess indicates some problem or incompatibility with our python2-urwid
package.
I was pleased to discover that our xfce already includes a panel applet
to configure wicd, but it fails due to the same permissions problem that
affects all the other wicd clients.
Anyway, if you want to try this out, here's what you need to change in
your OS configuration:
* (use-modules (gnu packages wicd)
(gnu services networking))
* Add wicd to the list passed to 'dbus-service'.
* Add (wicd-service) to 'services'.
* Add wicd to 'packages' (optional but recommended).
Special thanks to Pierre-Antoine Rault <address@hidden> for packaging
python-dbus and for the initial attempt at the 'wicd' package.
Comments, suggestions, and (most importantly) debugging welcome!
Mark
>From 42884490782c9956912e1239f9cc71f72b921ba9 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Tue, 3 Feb 2015 23:35:42 -0500
Subject: [PATCH 1/3] gnu: wpa-supplicant: Add dbus support; add
wpa-supplicant-light.
* gnu/packages/admin.scm (wpa-supplicant-light): New variable containing the
previous dbus-free package, but renamed. Remove outdated TODO comments.
(wpa-supplicant): Now inherits from wpa-supplicant-light but adds dbus
support.
* gnu/system/install.scm (installation-os): Use wpa-supplicant-light.
---
gnu/packages/admin.scm | 33 +++++++++++++++++++++++----------
gnu/system/install.scm | 2 +-
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index cadd3c4..0b3cc02 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -22,6 +22,7 @@
(define-module (gnu packages admin)
#:use-module (guix licenses)
#:use-module (guix packages)
+ #:use-module (guix utils)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system cmake)
@@ -675,9 +676,9 @@ commands and their arguments.")
;; See <http://www.sudo.ws/sudo/license.html>.
(license x11)))
-(define-public wpa-supplicant
+(define-public wpa-supplicant-light
(package
- (name "wpa-supplicant")
+ (name "wpa-supplicant-light")
(version "2.3")
(source (origin
(method url-fetch)
@@ -699,11 +700,6 @@ commands and their arguments.")
(display "
CONFIG_DEBUG_SYSLOG=y
- # TODO: Add a variant of this package with DBus support.
- #CONFIG_CTRL_IFACE_DBUS=y
- #CONFIG_CTRL_IFACE_DBUS_NEW=y
- #CONFIG_CTRL_IFACE_DBUS_INTRO=y
-
CONFIG_DRIVER_NL80211=y
CFLAGS += $(shell pkg-config libnl-3.0 --cflags)
CONFIG_LIBNL32=y
@@ -720,9 +716,6 @@ commands and their arguments.")
(inputs
`(("readline" ,readline)
("libnl" ,libnl)
- ;; TODO: Add a variant with DBus support. This significantly increases
- ;; the size of its closure since DBus depends on libx11.
- ;; ("dbus" ,dbus)
("openssl" ,o:openssl)))
(native-inputs
`(("pkg-config" ,pkg-config)))
@@ -740,6 +733,26 @@ This package provides the 'wpa_supplicant' daemon and the
'wpa_cli' command.")
;; In practice, this is linked against Readline, which makes it GPLv3+.
(license bsd-3)))
+(define-public wpa-supplicant
+ (package (inherit wpa-supplicant-light)
+ (name "wpa-supplicant")
+ (inputs `(("dbus" ,dbus)
+ ,@(package-inputs wpa-supplicant-light)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments wpa-supplicant-light)
+ ((#:phases phases)
+ `(alist-cons-after
+ 'configure 'configure-for-dbus
+ (lambda _
+ (let ((port (open-file ".config" "al")))
+ (display "
+ CONFIG_CTRL_IFACE_DBUS=y
+ CONFIG_CTRL_IFACE_DBUS_NEW=y
+ CONFIG_CTRL_IFACE_DBUS_INTRO=y\n" port)
+ (close-port port))
+ #t)
+ ,phases))))))
+
(define-public wakelan
(package
(name "wakelan")
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 5b6dabe..2e7e4ea 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -274,7 +274,7 @@ Use Alt-F2 for documentation.
parted ddrescue
grub ;mostly so xrefs to its manual work
cryptsetup
- wireless-tools iw wpa-supplicant
+ wireless-tools iw wpa-supplicant-light
;; XXX: We used to have GNU fdisk here, but as of version
;; 2.0.0a, that pulls Guile 1.8, which takes unreasonable
;; space; furthermore util-linux's fdisk is already
--
2.2.1
>From b61226176112a5b5a99482a3f102d9e35ae6f87e Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Tue, 3 Feb 2015 23:03:04 -0500
Subject: [PATCH 2/3] gnu: Add wicd.
Based on preliminary work by Pierre-Antoine Rault <address@hidden>
* gnu/packages/wicd.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
gnu-system.am | 1 +
gnu/packages/wicd.scm | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 176 insertions(+)
create mode 100644 gnu/packages/wicd.scm
diff --git a/gnu-system.am b/gnu-system.am
index f9abc97..9a8a377 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -284,6 +284,7 @@ GNU_SYSTEM_MODULES = \
gnu/packages/weechat.scm \
gnu/packages/wget.scm \
gnu/packages/which.scm \
+ gnu/packages/wicd.scm \
gnu/packages/wine.scm \
gnu/packages/wordnet.scm \
gnu/packages/wv.scm \
diff --git a/gnu/packages/wicd.scm b/gnu/packages/wicd.scm
new file mode 100644
index 0000000..72b8003
--- /dev/null
+++ b/gnu/packages/wicd.scm
@@ -0,0 +1,175 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Mark H Weaver <address@hidden>
+;;; Copyright © 2015 Pierre-Antoine Rault <address@hidden>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages wicd)
+ #:use-module (guix packages)
+ #:use-module (guix download)
+ #:use-module (guix build-system python)
+ #:use-module (guix licenses)
+ #:use-module (gnu packages glib)
+ #:use-module (gnu packages gtk)
+ #:use-module (gnu packages gettext)
+ #:use-module (gnu packages linux)
+ #:use-module (gnu packages admin)
+ #:use-module (gnu packages python))
+
+(define-public wicd
+ (package
+ (name "wicd")
+ (version "1.7.3")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "https://launchpad.net/wicd/1.7/" version
+ "/+download/wicd-" version ".tar.gz"))
+ (sha256
+ (base32 "00c4rq753bhg64rv1v9yl834ssq7igyy7cz3swp287b5n5bqiqwi"))))
+ (build-system python-build-system)
+ (native-inputs `(("gettext" ,gnu-gettext)))
+ (inputs `(("dbus" ,dbus)
+ ("dbus-glib" ,dbus-glib)
+ ("python2-dbus" ,python2-dbus)
+ ("python2-pygtk" ,python2-pygtk)
+ ("python2-urwid" ,python2-urwid)
+ ("python2-babel" ,python2-babel)
+ ("wireless-tools" ,wireless-tools)
+ ("wpa-supplicant" ,wpa-supplicant)
+ ("net-tools" ,net-tools)
+ ("isc-dhcp" ,isc-dhcp)
+ ("iproute" ,iproute)))
+ (arguments
+ `(#:python ,python-2
+ #:tests? #f ; test suite requires networking
+ #:phases
+ (alist-cons-before
+ 'build 'configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python")))
+ (define (which* cmd)
+ (cond ((string=? cmd "ping")
+ "/run/setuid-programs/ping")
+ ((which cmd)
+ => identity)
+ (else
+ (format (current-error-port)
+ "WARNING: Unable to find absolute path for ~s~%"
+ cmd)
+ #f)))
+ (substitute* "setup.py"
+ ;; The handling of unrecognized distros in setup.py is
+ ;; broken. Work around the problem.
+ (("\\('init=', ") "#('init=', ")
+ ;; Inhibit attempts to install in /var or /etc.
+ (("\\(wpath\\.(log|etc|networks|.*scripts), " all)
+ (string-append "#" all)))
+
+ ;; Patch references to subprograms with absolute pathnames.
+ (substitute* "wicd/wnettools.py"
+ (("(misc\\.Run\\(\\[?[\"'])([^\"' ]*)" all pre cmd)
+ (string-append pre (which* cmd)))
+
(("(self\\._find_program_path|misc\\.find_path)\\([\"']([^\"']*)[\"']\\)"
+ all dummy cmd)
+ (let ((pathname (which* cmd)))
+ (if pathname
+ (string-append "'" pathname "'")
+ "None")))
+
(("([\"'])(ifconfig|route|wpa_cli|wpa_supplicant|iwconfig|iwpriv|iwlist|ping)"
+ all open-quote cmd)
+ (string-append open-quote (which* cmd))))
+
+ ;; setup.py cannot cope without LANG
+ (setenv "LANG" "C")
+
+ (let ((params
+ (list
+ (string-append "--python=" python "/bin/python")
+ "--no-install-init"
+ "--no-install-docs"
+ "--no-install-acpi"
+ "--no-install-pmutils"
+ "--no-install-kde"
+ "--no-install-gnome-shell-extensions"
+
+ "--distro=guixsd"
+ "--wicdgroup=netdev"
+ "--loggroup=root"
+ "--logperms=0640"
+
+ ;; XXX setup.py configure asks us to pass --init=,
+ ;; but if we do it says "no such option 'init'".
+ ;; (string-append "--init=" out "/etc/init.d")
+
+ (string-append "--initfile=" out "/etc/init.d/wicd")
+ (string-append "--lib=" out "/lib/wicd")
+ (string-append "--share=" out "/share/wicd")
+
+ "--etc=/etc/wicd"
+ "--scripts=/etc/wicd/scripts"
+ "--pmutils=/etc/pm-utils/sleep.d"
+
+ (string-append "--encryption="
+ out "/etc/encryption/templates")
+ (string-append "--bin=" out "/bin")
+ (string-append "--sbin=" out "/sbin")
+ (string-append "--daemon=" out "/share/wicd/daemon")
+ (string-append "--backends=" out "/share/wicd/backends")
+ (string-append "--curses=" out "/share/wicd/curses")
+ (string-append "--gtk=" out "/share/wicd/gtk")
+ (string-append "--cli=" out "/share/wicd/cli")
+ (string-append "--gnome-shell-extensions="
+ out "/share/gnome-shell-extensions")
+ (string-append "--icons=" out "/share/icons/hicolor")
+ (string-append "--pixmaps=" out "/share/pixmaps")
+ (string-append "--images=" out "/share/wicd/icons")
+ (string-append "--dbus=" out "/etc/dbus-1/system.d")
+ (string-append "--dbus-service="
+ out "/share/dbus-1/system-services")
+ (string-append "--systemd=" out "/lib/systemd/system")
+ (string-append "--logrotate=" out "/etc/logrotate.d")
+ (string-append "--desktop=" out "/share/applications")
+ (string-append "--translations=" out "/share/locale")
+ (string-append "--autostart=" out "/etc/xdg/autostart")
+ (string-append "--docdir=" out "/share/doc/wicd")
+ (string-append "--mandir=" out "/share/man")
+ (string-append "--kdedir=" out "/share/autostart"))))
+ (format #t
+ "running ~s with command ~s and parameters ~s~%"
+ "python setup.py" "configure" params)
+ (zero? (apply system* "python" "setup.py" "configure" params)))))
+ (alist-cons-after
+ 'install 'install-dhclient.conf.template.default
+ (lambda* (#:key outputs #:allow-other-keys)
+ ;; wicd's installer tries to put dhclient.conf.template.default
+ ;; in /etc/wicd/other, which is not available in the build
+ ;; environment, so here we install it manually in the output
+ ;; directory.
+ (let* ((out (assoc-ref outputs "out"))
+ (dest-dir (string-append out "/etc/wicd"))
+ (name "dhclient.conf.template.default"))
+ (mkdir-p dest-dir)
+ (copy-file (string-append "other/" name)
+ (string-append dest-dir "/" name))
+ #t))
+ %standard-phases))))
+ (synopsis "Network connection manager")
+ (description "Wicd is a network manager that aims to simplify wired and
+wireless networking.")
+ (home-page "https://launchpad.net/wicd")
+ (license gpl2+)))
--
2.2.1
>From cfe983f263e3c08a332c96d295aa5743b2b4ccfe Mon Sep 17 00:00:00 2001
From: Mark H Weaver <address@hidden>
Date: Wed, 4 Feb 2015 03:39:48 -0500
Subject: [PATCH 3/3] services: Add wicd service.
* gnu/services/networking.scm (wicd-service): New procedure.
* doc/guix.texi (Networking Services): Document it.
---
doc/guix.texi | 6 ++++++
gnu/services/networking.scm | 27 ++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index fa3aa6d..4edcf58 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4443,6 +4443,12 @@ Return a service that starts @var{interface} with
address @var{ip}. If
gateway.
@end deffn
address@hidden wicd
address@hidden {Monadic Procedure} wicd-service [#:wicd @var{wicd}]
+Return a service that runs @url{https://launchpad.net/wicd,Wicd}, a
+network manager that aims to simplify wired and wireless networking.
address@hidden deffn
+
@deffn {Monadic Procedure} ntp-service [#:ntp @var{ntp}] @
[#:name-service @var{%ntp-servers}]
Return a service that runs the daemon from @var{ntp}, the
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index f0c3538..a2d8e3a 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015 Mark H Weaver <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,6 +25,7 @@
#:use-module (gnu packages tor)
#:use-module (gnu packages messaging)
#:use-module (gnu packages ntp)
+ #:use-module (gnu packages wicd)
#:use-module (guix gexp)
#:use-module (guix store)
#:use-module (guix monads)
@@ -34,7 +36,8 @@
%ntp-servers
ntp-service
tor-service
- bitlbee-service))
+ bitlbee-service
+ wicd-service))
;;; Commentary:
;;;
@@ -297,4 +300,26 @@ configuration file."
(shell #~(string-append #$shadow
"/sbin/nologin")))))))))
+(define* (wicd-service #:key (wicd wicd))
+ "Return a service that runs @url{https://launchpad.net/wicd,Wicd}, a network
+manager that aims to simplify wired and wireless networking."
+ (with-monad %store-monad
+ (return
+ (service
+ (documentation "Run the Wicd network manager.")
+ (provision '(networking))
+ (requirement '(user-processes dbus-system loopback))
+ (start #~(make-forkexec-constructor
+ (list (string-append #$wicd "/sbin/wicd")
+ "--no-daemon")))
+ (stop #~(make-kill-destructor))
+ (activate
+ #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/etc/wicd")
+ (let ((file-name "/etc/wicd/dhclient.conf.template.default"))
+ (unless (file-exists? file-name)
+ (copy-file (string-append #$wicd file-name)
+ file-name)))))))))
+
;;; networking.scm ends here
--
2.2.1
- [PATCHES] Add wicd and wicd-service,
Mark H Weaver <=
- Re: [PATCHES] Add wicd and wicd-service, Mark H Weaver, 2015/02/04
- Re: [PATCHES] Add wicd and wicd-service, Ludovic Courtès, 2015/02/04
- Re: [PATCHES] Add wicd and wicd-service, Mark H Weaver, 2015/02/04
- Re: [PATCHES] Add wicd and wicd-service, Mark H Weaver, 2015/02/04
- Re: [PATCHES] Add wicd and wicd-service, Ludovic Courtès, 2015/02/12