mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
system: Add 'create-mount-point?' file system option.
* gnu/system/file-systems.scm (<file-system>)[create-mount-point?]: New field. * gnu/services/base.scm (file-system-service): Add #:create-mount-point? parameter and honor it. * gnu/system.scm (other-file-system-services): Update 'file-system-service' call accordingly. * doc/guix.texi (File Systems): Document it.
This commit is contained in:
parent
5ac12a4f77
commit
4e469051a7
4 changed files with 17 additions and 4 deletions
|
@ -3054,6 +3054,9 @@ instance, for the root file system.
|
||||||
This Boolean indicates whether the file system needs to be checked for
|
This Boolean indicates whether the file system needs to be checked for
|
||||||
errors before being mounted.
|
errors before being mounted.
|
||||||
|
|
||||||
|
@item @code{create-mount-point?} (default: @code{#f})
|
||||||
|
When true, the mount point is created if it does not exist yet.
|
||||||
|
|
||||||
@end table
|
@end table
|
||||||
@end deftp
|
@end deftp
|
||||||
|
|
||||||
|
|
|
@ -96,11 +96,13 @@ (define (root-file-system-service)
|
||||||
(respawn? #f)))))
|
(respawn? #f)))))
|
||||||
|
|
||||||
(define* (file-system-service device target type
|
(define* (file-system-service device target type
|
||||||
#:key (check? #t) options (title 'any))
|
#:key (check? #t) create-mount-point?
|
||||||
|
options (title 'any))
|
||||||
"Return a service that mounts DEVICE on TARGET as a file system TYPE with
|
"Return a service that mounts DEVICE on TARGET as a file system TYPE with
|
||||||
OPTIONS. TITLE is a symbol specifying what kind of name DEVICE is: 'label for
|
OPTIONS. TITLE is a symbol specifying what kind of name DEVICE is: 'label for
|
||||||
a partition label, 'device for a device file name, or 'any. When CHECK? is
|
a partition label, 'device for a device file name, or 'any. When CHECK? is
|
||||||
true, check the file system before mounting it."
|
true, check the file system before mounting it. When CREATE-MOUNT-POINT? is
|
||||||
|
true, create TARGET if it does not exist yet."
|
||||||
(with-monad %store-monad
|
(with-monad %store-monad
|
||||||
(return
|
(return
|
||||||
(service
|
(service
|
||||||
|
@ -109,6 +111,9 @@ (define* (file-system-service device target type
|
||||||
(documentation "Check, mount, and unmount the given file system.")
|
(documentation "Check, mount, and unmount the given file system.")
|
||||||
(start #~(lambda args
|
(start #~(lambda args
|
||||||
(let ((device (canonicalize-device-spec #$device '#$title)))
|
(let ((device (canonicalize-device-spec #$device '#$title)))
|
||||||
|
#$(if create-mount-point?
|
||||||
|
#~(mkdir-p #$target)
|
||||||
|
#~#t)
|
||||||
#$(if check?
|
#$(if check?
|
||||||
#~(begin
|
#~(begin
|
||||||
;; Make sure fsck.ext2 & co. can be found.
|
;; Make sure fsck.ext2 & co. can be found.
|
||||||
|
|
|
@ -181,10 +181,11 @@ (define file-systems
|
||||||
(sequence %store-monad
|
(sequence %store-monad
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
(($ <file-system> device title target type flags opts
|
(($ <file-system> device title target type flags opts
|
||||||
#f check?)
|
#f check? create?)
|
||||||
(file-system-service device target type
|
(file-system-service device target type
|
||||||
#:title title
|
#:title title
|
||||||
#:check? check?
|
#:check? check?
|
||||||
|
#:create-mount-point? create?
|
||||||
#:options opts)))
|
#:options opts)))
|
||||||
file-systems)))
|
file-systems)))
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ (define-module (gnu system file-systems)
|
||||||
file-system-needed-for-boot?
|
file-system-needed-for-boot?
|
||||||
file-system-flags
|
file-system-flags
|
||||||
file-system-options
|
file-system-options
|
||||||
|
file-system-check?
|
||||||
|
file-system-create-mount-point?
|
||||||
|
|
||||||
%fuse-control-file-system
|
%fuse-control-file-system
|
||||||
%binary-format-file-system
|
%binary-format-file-system
|
||||||
|
@ -57,7 +59,9 @@ (define-record-type* <file-system> file-system
|
||||||
(needed-for-boot? file-system-needed-for-boot? ; Boolean
|
(needed-for-boot? file-system-needed-for-boot? ; Boolean
|
||||||
(default #f))
|
(default #f))
|
||||||
(check? file-system-check? ; Boolean
|
(check? file-system-check? ; Boolean
|
||||||
(default #t)))
|
(default #t))
|
||||||
|
(create-mount-point? file-system-create-mount-point? ; Boolean
|
||||||
|
(default #f)))
|
||||||
|
|
||||||
(define %fuse-control-file-system
|
(define %fuse-control-file-system
|
||||||
;; Control file system for Linux' file systems in user-space (FUSE).
|
;; Control file system for Linux' file systems in user-space (FUSE).
|
||||||
|
|
Loading…
Reference in a new issue