[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70542] [PATCH 2/4] services: base: Use requirements to delay some f
From: |
Richard Sent |
Subject: |
[bug#70542] [PATCH 2/4] services: base: Use requirements to delay some file-systems |
Date: |
Tue, 23 Apr 2024 16:47:20 -0400 |
Add a mechanism to only require a subset of file-system entries during early
Shepherd initialization. Any file-system with additional Shepherd service
requirements (e.g. networking) will be brought up after 'file-systems is
provisioned.
* gnu/services/base.scm (file-system-shepherd-service): Splice
file-system-requirements into the Shepherd service requirement list.
* gnu/services/base.scm (file-system-shepherd-services): Provision
'file-system when file-systems that satisfy initial-file-system? are started.
Change-Id: I7b1336ee970f4320f7431bef187e66f34f0d718c
---
gnu/services/base.scm | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3f912225a0..af92b700b4 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -403,6 +403,7 @@ (define (file-system-shepherd-service file-system)
(create? (file-system-create-mount-point? file-system))
(mount? (file-system-mount? file-system))
(dependencies (file-system-dependencies file-system))
+ (requirements (file-system-requirements file-system))
(packages (file-system-packages (list file-system))))
(and (or mount? create?)
(with-imported-modules (source-module-closure
@@ -411,7 +412,8 @@ (define (file-system-shepherd-service file-system)
(provision (list (file-system->shepherd-service-name file-system)))
(requirement `(root-file-system
udev
- ,@(map dependency->shepherd-service-name
dependencies)))
+ ,@(map dependency->shepherd-service-name
dependencies)
+ ,@requirements))
(documentation "Check, mount, and unmount the given file system.")
(start #~(lambda args
#$(if create?
@@ -460,12 +462,22 @@ (define (file-system-shepherd-services file-systems)
(or (file-system-mount? x)
(file-system-create-mount-point? x)))
file-systems)))
+
+ (define (initial-file-system? file-system)
+ "Return #t if the file system should be mounted initially or #f."
+ ;; File systems with additional Shepherd requirements (e.g. networking)
+ ;; should not be considered initial. Those requirements likely rely on
+ ;; 'file-systems being provisioned.
+ (null? (file-system-requirements file-system)))
+
(define sink
(shepherd-service
(provision '(file-systems))
(requirement (cons* 'root-file-system 'user-file-systems
(map file-system->shepherd-service-name
- file-systems)))
+ ;; Only file systems considered initial should
+ ;; be required to provision 'file-systems.
+ (filter initial-file-system? file-systems))))
(documentation "Target for all the initially-mounted file systems")
(start #~(const #t))
(stop #~(const #f))))
--
2.41.0
[bug#70542] [PATCH 4/4] system: Do not check for CIFS file system availability, Richard Sent, 2024/04/23
[bug#70542] Missing reference in cover letter, Richard Sent, 2024/04/23
[bug#70542] [PATCH v2 1/3] services: base: Add optional delayed mount of file-systems, Richard Sent, 2024/04/25