guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/08: services: dhcp-client-configuration: Allow provision override.


From: guix-commits
Subject: 03/08: services: dhcp-client-configuration: Allow provision override.
Date: Sun, 17 Sep 2023 09:37:19 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 04f71edb73205d0bb82404de28a70ae17b897429
Author: Alexey Abramov <levenson@mmer.org>
AuthorDate: Tue Jul 25 12:59:56 2023 +0200

    services: dhcp-client-configuration: Allow provision override.
    
    * gnu/services/networking.scm 
(<dhcp-client-configuration>)[shepherd-provision]:
    New field.
    (dhcp-client-shepherd-service): Honor it.
    * doc/guix.texi (Networking Setup): Document it.
    
    Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 doc/guix.texi               |  6 ++++++
 gnu/services/networking.scm | 11 +++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 46cc8e1b80..983b471fd8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -20461,10 +20461,16 @@ non-loopback interfaces that can be activated.  
Otherwise the DHCP
 client listens only on the specified interfaces.
 
 @item @code{shepherd-requirement} (default: @code{'()})
+@itemx @code{shepherd-provision} (default: @code{'(networking)})
 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.
+
+Likewise, @code{shepherd-provision} is a list of Shepherd service names
+(symbols) provided by this service.  You might want to change the
+default value if you intend to run several DHCP clients, only one of
+which provides the @code{networking} Shepherd service.
 @end table
 @end deftp
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index e2f6e6c0ca..ec34137d39 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -89,6 +89,7 @@
             dhcp-client-configuration?
             dhcp-client-configuration-package
             dhcp-client-configuration-interfaces
+            dhcp-client-configuration-shepherd-provision
             dhcp-client-configuration-shepherd-requirement
 
             dhcpd-service-type
@@ -303,6 +304,8 @@
                 (default isc-dhcp))
   (shepherd-requirement dhcp-client-configuration-shepherd-requirement
                         (default '()))
+  (shepherd-provision   dhcp-client-configuration-provision
+                        (default '(networking)))
   (interfaces   dhcp-client-configuration-interfaces
                 (default 'all)))                  ;'all | list of strings
 
@@ -310,19 +313,19 @@
   (match-lambda
     ((? dhcp-client-configuration? config)
      (let ((package (dhcp-client-configuration-package config))
-           (shepherd-requirement 
(dhcp-client-configuration-shepherd-requirement config))
+           (requirement (dhcp-client-configuration-shepherd-requirement 
config))
+           (provision (dhcp-client-configuration-shepherd-provision config))
            (interfaces (dhcp-client-configuration-interfaces config))
            (pid-file "/var/run/dhclient.pid"))
        (list (shepherd-service
               (documentation "Set up networking via DHCP.")
-              (requirement `(user-processes udev ,@shepherd-requirement))
+              (requirement `(user-processes udev ,@requirement))
+              (provision provision)
 
               ;; XXX: Running with '-nw' ("no wait") avoids blocking for a 
minute when
               ;; networking is unavailable, but also means that the interface 
is not up
               ;; yet when 'start' completes.  To wait for the interface to be 
ready, one
               ;; should instead monitor udev events.
-              (provision '(networking))
-
               (start #~(lambda _
                          (define dhclient
                            (string-append #$package "/sbin/dhclient"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]