From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Darrington Subject: [PATCH] gnu: Allow nfs filesystems to be automatically mounted. Date: Tue, 22 Nov 2016 20:15:00 +0100 Message-ID: <1479842100-13226-1-git-send-email-jmd@gnu.org> References: <87a8cy780c.fsf@gnu.org> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c9GX6-0004IA-Uk for guix-devel@gnu.org; Tue, 22 Nov 2016 14:15:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c9GX3-0001vH-Or for guix-devel@gnu.org; Tue, 22 Nov 2016 14:15:08 -0500 In-Reply-To: <87a8cy780c.fsf@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: John Darrington 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 ;; , which still applies to Linux 4.0. -- 2.1.4