services: connman: Add 'shepherd-requirement' field.

* gnu/services/networking.scm (<connman-configuration>)
[shepherd-requirement]: New field.
(connman-shepherd-service): Honor it.
(connman-configuration-shepherd-requirement): Export accessor.
* doc/guix.texi (Networking Setup): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Bruno Victal 2023-03-07 12:44:01 +00:00 committed by Ludovic Courtès
parent 1545dab1fa
commit 269871d18e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 14 additions and 4 deletions

View file

@ -19917,6 +19917,12 @@ Data Type representing the configuration of connman.
@item @code{connman} (default: @var{connman}) @item @code{connman} (default: @var{connman})
The connman package to use. The connman package to use.
@item @code{shepherd-requirement} (default: @code{()})
This option can be used to provide a list of symbols naming Shepherd services
that this service will depend on, such as @code{'wpa-supplicant} or
@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet
networks.
@item @code{disable-vpn?} (default: @code{#f}) @item @code{disable-vpn?} (default: @code{#f})
When true, disable connman's vpn plugin. When true, disable connman's vpn plugin.

View file

@ -151,6 +151,7 @@ (define-module (gnu services networking)
connman-configuration connman-configuration
connman-configuration? connman-configuration?
connman-configuration-connman connman-configuration-connman
connman-configuration-shepherd-requirement
connman-configuration-disable-vpn? connman-configuration-disable-vpn?
connman-configuration-iwd? connman-configuration-iwd?
connman-service-type connman-service-type
@ -1288,6 +1289,8 @@ (define-record-type* <connman-configuration>
connman-configuration? connman-configuration?
(connman connman-configuration-connman (connman connman-configuration-connman
(default connman)) (default connman))
(shepherd-requirement connman-configuration-shepherd-requirement
(default '()))
(disable-vpn? connman-configuration-disable-vpn? (disable-vpn? connman-configuration-disable-vpn?
(default #f)) (default #f))
(iwd? connman-configuration-iwd? (iwd? connman-configuration-iwd?
@ -1303,13 +1306,14 @@ (define (connman-activation config)
(mkdir-p "/var/lib/connman-vpn/")))))) (mkdir-p "/var/lib/connman-vpn/"))))))
(define (connman-shepherd-service config) (define (connman-shepherd-service config)
(match-record config <connman-configuration> (connman disable-vpn? iwd?) (match-record config <connman-configuration> (connman shepherd-requirement
disable-vpn? iwd?)
(list (shepherd-service (list (shepherd-service
(documentation "Run Connman") (documentation "Run Connman")
(provision '(networking)) (provision '(networking))
(requirement (requirement `(user-processes dbus-system loopback
(append '(user-processes dbus-system loopback) ,@shepherd-requirement
(if iwd? '(iwd) '()))) ,@(if iwd? '(iwd) '())))
(start #~(make-forkexec-constructor (start #~(make-forkexec-constructor
(list (string-append #$connman (list (string-append #$connman
"/sbin/connmand") "/sbin/connmand")