diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-07-22 22:53:36 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-07-23 02:02:06 +0200 |
| commit | 4e469051a77d02435eafb1df93224a2ce1bb3146 (patch) | |
| tree | e0bb010dec21062caf959ba0cfdb7cfe3e28dc12 | |
| parent | 5ac12a4f778f1cce8aff10fe3ef30be1a85e4647 (diff) | |
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.
| -rw-r--r-- | doc/guix.texi | 3 | ||||
| -rw-r--r-- | gnu/services/base.scm | 9 | ||||
| -rw-r--r-- | gnu/system.scm | 3 | ||||
| -rw-r--r-- | gnu/system/file-systems.scm | 6 |
4 files changed, 17 insertions, 4 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 2b05a75be40..a88b546380c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -3054,6 +3054,9 @@ instance, for the root file system. | |||
| 3054 | This Boolean indicates whether the file system needs to be checked for | 3054 | This Boolean indicates whether the file system needs to be checked for |
| 3055 | errors before being mounted. | 3055 | errors before being mounted. |
| 3056 | 3056 | ||
| 3057 | @item @code{create-mount-point?} (default: @code{#f}) | ||
| 3058 | When true, the mount point is created if it does not exist yet. | ||
| 3059 | |||
| 3057 | @end table | 3060 | @end table |
| 3058 | @end deftp | 3061 | @end deftp |
| 3059 | 3062 | ||
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 42e232c9ac2..9a67109db01 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm | |||
| @@ -96,11 +96,13 @@ This service must be the root of the service dependency graph so that its | |||
| 96 | (respawn? #f))))) | 96 | (respawn? #f))))) |
| 97 | 97 | ||
| 98 | (define* (file-system-service device target type | 98 | (define* (file-system-service device target type |
| 99 | #:key (check? #t) options (title 'any)) | 99 | #:key (check? #t) create-mount-point? |
| 100 | options (title 'any)) | ||
| 100 | "Return a service that mounts DEVICE on TARGET as a file system TYPE with | 101 | "Return a service that mounts DEVICE on TARGET as a file system TYPE with |
| 101 | OPTIONS. TITLE is a symbol specifying what kind of name DEVICE is: 'label for | 102 | OPTIONS. TITLE is a symbol specifying what kind of name DEVICE is: 'label for |
| 102 | a partition label, 'device for a device file name, or 'any. When CHECK? is | 103 | a partition label, 'device for a device file name, or 'any. When CHECK? is |
| 103 | true, check the file system before mounting it." | 104 | true, check the file system before mounting it. When CREATE-MOUNT-POINT? is |
| 105 | true, create TARGET if it does not exist yet." | ||
| 104 | (with-monad %store-monad | 106 | (with-monad %store-monad |
| 105 | (return | 107 | (return |
| 106 | (service | 108 | (service |
| @@ -109,6 +111,9 @@ true, check the file system before mounting it." | |||
| 109 | (documentation "Check, mount, and unmount the given file system.") | 111 | (documentation "Check, mount, and unmount the given file system.") |
| 110 | (start #~(lambda args | 112 | (start #~(lambda args |
| 111 | (let ((device (canonicalize-device-spec #$device '#$title))) | 113 | (let ((device (canonicalize-device-spec #$device '#$title))) |
| 114 | #$(if create-mount-point? | ||
| 115 | #~(mkdir-p #$target) | ||
| 116 | #~#t) | ||
| 112 | #$(if check? | 117 | #$(if check? |
| 113 | #~(begin | 118 | #~(begin |
| 114 | ;; Make sure fsck.ext2 & co. can be found. | 119 | ;; Make sure fsck.ext2 & co. can be found. |
diff --git a/gnu/system.scm b/gnu/system.scm index 20942ec7f05..8c6fc130591 100644 --- a/gnu/system.scm +++ b/gnu/system.scm | |||
| @@ -181,10 +181,11 @@ as 'needed-for-boot'." | |||
| 181 | (sequence %store-monad | 181 | (sequence %store-monad |
| 182 | (map (match-lambda | 182 | (map (match-lambda |
| 183 | (($ <file-system> device title target type flags opts | 183 | (($ <file-system> device title target type flags opts |
| 184 | #f check?) | 184 | #f check? create?) |
| 185 | (file-system-service device target type | 185 | (file-system-service device target type |
| 186 | #:title title | 186 | #:title title |
| 187 | #:check? check? | 187 | #:check? check? |
| 188 | #:create-mount-point? create? | ||
| 188 | #:options opts))) | 189 | #:options opts))) |
| 189 | file-systems))) | 190 | file-systems))) |
| 190 | 191 | ||
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 0c2021d7b41..ea8d9613174 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | file-system-needed-for-boot? | 28 | file-system-needed-for-boot? |
| 29 | file-system-flags | 29 | file-system-flags |
| 30 | file-system-options | 30 | file-system-options |
| 31 | file-system-check? | ||
| 32 | file-system-create-mount-point? | ||
| 31 | 33 | ||
| 32 | %fuse-control-file-system | 34 | %fuse-control-file-system |
| 33 | %binary-format-file-system | 35 | %binary-format-file-system |
| @@ -57,7 +59,9 @@ | |||
| 57 | (needed-for-boot? file-system-needed-for-boot? ; Boolean | 59 | (needed-for-boot? file-system-needed-for-boot? ; Boolean |
| 58 | (default #f)) | 60 | (default #f)) |
| 59 | (check? file-system-check? ; Boolean | 61 | (check? file-system-check? ; Boolean |
| 60 | (default #t))) | 62 | (default #t)) |
| 63 | (create-mount-point? file-system-create-mount-point? ; Boolean | ||
| 64 | (default #f))) | ||
| 61 | 65 | ||
| 62 | (define %fuse-control-file-system | 66 | (define %fuse-control-file-system |
| 63 | ;; Control file system for Linux' file systems in user-space (FUSE). | 67 | ;; Control file system for Linux' file systems in user-space (FUSE). |
