guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gnu: Allow nfs filesystems to be automatically mounted.


From: John Darrington
Subject: [PATCH] gnu: Allow nfs filesystems to be automatically mounted.
Date: Tue, 22 Nov 2016 20:15:00 +0100

How about this, then?





* gnu/build/file-systems.scm (mount-file-system): Append target addr= when
mounting nfs filesystems.
---
 gnu/build/file-systems.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 0d55e91..c6fc784 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -481,7 +481,21 @@ run a file system check."
              (call-with-output-file mount-point (const #t)))
            (mkdir-p mount-point))
 
-       (mount source mount-point type flags options)
+       (mount source mount-point type flags
+              (cond
+               ((string-match "^nfs.*" type)
+                (let* ((host (car (string-split source #\:)))
+                       (aa (car (getaddrinfo host #f)))
+                       (sa (addrinfo:addr aa))
+                       (inet-addr (inet-ntop (sockaddr:fam sa)
+                                             (sockaddr:addr sa))))
+                  (string-append "addr="
+                                 inet-addr
+                                 (if options
+                                     (string-append "," options)
+                                     ""))))
+               (else
+                options)))
 
        ;; For read-only bind mounts, an extra remount is needed, as per
        ;; <http://lwn.net/Articles/281157/>, which still applies to Linux 4.0.
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]