mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
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>
This commit is contained in:
parent
944c1b62a1
commit
04f71edb73
2 changed files with 13 additions and 4 deletions
|
@ -20461,10 +20461,16 @@ non-loopback interfaces that can be activated. Otherwise the DHCP
|
||||||
client listens only on the specified interfaces.
|
client listens only on the specified interfaces.
|
||||||
|
|
||||||
@item @code{shepherd-requirement} (default: @code{'()})
|
@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
|
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
|
that this service will depend on, such as @code{'wpa-supplicant} or
|
||||||
@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet
|
@code{'iwd} if you require authenticated access for encrypted WiFi or Ethernet
|
||||||
networks.
|
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 table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@ (define-module (gnu services networking)
|
||||||
dhcp-client-configuration?
|
dhcp-client-configuration?
|
||||||
dhcp-client-configuration-package
|
dhcp-client-configuration-package
|
||||||
dhcp-client-configuration-interfaces
|
dhcp-client-configuration-interfaces
|
||||||
|
dhcp-client-configuration-shepherd-provision
|
||||||
dhcp-client-configuration-shepherd-requirement
|
dhcp-client-configuration-shepherd-requirement
|
||||||
|
|
||||||
dhcpd-service-type
|
dhcpd-service-type
|
||||||
|
@ -303,6 +304,8 @@ (define-record-type* <dhcp-client-configuration>
|
||||||
(default isc-dhcp))
|
(default isc-dhcp))
|
||||||
(shepherd-requirement dhcp-client-configuration-shepherd-requirement
|
(shepherd-requirement dhcp-client-configuration-shepherd-requirement
|
||||||
(default '()))
|
(default '()))
|
||||||
|
(shepherd-provision dhcp-client-configuration-provision
|
||||||
|
(default '(networking)))
|
||||||
(interfaces dhcp-client-configuration-interfaces
|
(interfaces dhcp-client-configuration-interfaces
|
||||||
(default 'all))) ;'all | list of strings
|
(default 'all))) ;'all | list of strings
|
||||||
|
|
||||||
|
@ -310,19 +313,19 @@ (define dhcp-client-shepherd-service
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((? dhcp-client-configuration? config)
|
((? dhcp-client-configuration? config)
|
||||||
(let ((package (dhcp-client-configuration-package 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))
|
(interfaces (dhcp-client-configuration-interfaces config))
|
||||||
(pid-file "/var/run/dhclient.pid"))
|
(pid-file "/var/run/dhclient.pid"))
|
||||||
(list (shepherd-service
|
(list (shepherd-service
|
||||||
(documentation "Set up networking via DHCP.")
|
(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
|
;; XXX: Running with '-nw' ("no wait") avoids blocking for a minute when
|
||||||
;; networking is unavailable, but also means that the interface is not up
|
;; 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
|
;; yet when 'start' completes. To wait for the interface to be ready, one
|
||||||
;; should instead monitor udev events.
|
;; should instead monitor udev events.
|
||||||
(provision '(networking))
|
|
||||||
|
|
||||||
(start #~(lambda _
|
(start #~(lambda _
|
||||||
(define dhclient
|
(define dhclient
|
||||||
(string-append #$package "/sbin/dhclient"))
|
(string-append #$package "/sbin/dhclient"))
|
||||||
|
|
Loading…
Reference in a new issue