summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-23 00:44:27 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-23 02:02:07 +0200
commit2c071ce96e7e4049be3ae2eb958077566d3b4ea0 (patch)
tree0f4e3f8c84d42839064d9b8c4441642f3e9b2b9a /gnu
parenta85b83d2270673fdb00d03bbec7e3378c6adcac2 (diff)
downloadguix-2c071ce96e7e4049be3ae2eb958077566d3b4ea0.tar.gz
system: Recognize more file system flags.
* guix/build/linux-initrd.scm (MS_NOSUID, MS_NODEV, MS_NOEXEC): New
  variables.
  (mount-flags->bit-mask): New procedure.
  (mount-file-system)[flags->bit-mask]: Remove.
  Use 'mount-flags->bit-mask' instead.
  In /etc/mtab, use the empty string when OPTIONS is false.
* gnu/services/base.scm (file-system-service): Add #:flags parameter and
  honor it.
* gnu/system.scm (other-file-system-services): Pass FLAGS to
  'file-system-service'.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm13
-rw-r--r--gnu/system.scm3
2 files changed, 11 insertions, 5 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 2c9054af48..342b3c1488 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -29,6 +29,8 @@
   #:use-module ((gnu packages base)
                 #:select (glibc-final))
   #:use-module (gnu packages package-management)
+  #:use-module ((guix build linux-initrd)
+                #:select (mount-flags->bit-mask))
   #:use-module (guix gexp)
   #:use-module (guix monads)
   #:use-module (srfi srfi-1)
@@ -96,13 +98,14 @@ 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) create-mount-point?
-                              options (title 'any))
+                              #:key (flags '()) (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.  When CREATE-MOUNT-POINT? is
-true, create TARGET if it does not exist yet."
+true, create TARGET if it does not exist yet.  FLAGS is a list of symbols,
+such as 'read-only' etc."
   (with-monad %store-monad
     (return
      (service
@@ -124,7 +127,9 @@ true, create TARGET if it does not exist yet."
                                       (getenv "PATH")))
                              (check-file-system device #$type))
                          #~#t)
-                   (mount device #$target #$type 0 #$options))
+                   (mount device #$target #$type
+                          #$(mount-flags->bit-mask flags)
+                          #$options))
                  #t))
       (stop #~(lambda args
                 ;; Normally there are no processes left at this point, so
diff --git a/gnu/system.scm b/gnu/system.scm
index 8c6fc13059..4648d810a3 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -186,7 +186,8 @@ as 'needed-for-boot'."
                                         #:title title
                                         #:check? check?
                                         #:create-mount-point? create?
-                                        #:options opts)))
+                                        #:options opts
+                                        #:flags flags)))
                  file-systems)))
 
 (define (essential-services os)