summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-22 22:53:36 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-23 02:02:06 +0200
commit4e469051a77d02435eafb1df93224a2ce1bb3146 (patch)
treee0bb010dec21062caf959ba0cfdb7cfe3e28dc12 /gnu/services
parent5ac12a4f778f1cce8aff10fe3ef30be1a85e4647 (diff)
downloadguix-4e469051a77d02435eafb1df93224a2ce1bb3146.tar.gz
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.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm9
1 files changed, 7 insertions, 2 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 42e232c9ac..9a67109db0 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
       (respawn? #f)))))
 
 (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
 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
-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
     (return
      (service
@@ -109,6 +111,9 @@ true, check the file system before mounting it."
       (documentation "Check, mount, and unmount the given file system.")
       (start #~(lambda args
                  (let ((device (canonicalize-device-spec #$device '#$title)))
+                   #$(if create-mount-point?
+                         #~(mkdir-p #$target)
+                         #~#t)
                    #$(if check?
                          #~(begin
                              ;; Make sure fsck.ext2 & co. can be found.