From patchwork Fri Jan 3 17:34:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19560 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E957C179EA; Fri, 3 Jan 2020 17:36:38 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 6B89F17979 for ; Fri, 3 Jan 2020 17:36:38 +0000 (GMT) Received: from localhost ([::1]:55246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsH-0007RL-Pd for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37421) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrl-000779-4a for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQri-00035A-Q6 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35435) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQri-00033z-Jd for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQri-0008Ga-HU for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 1/9] gnu: nfs-utils: Update to 2.4.2. References: <20200103173238.9598-1-rekado@elephly.net> In-Reply-To: <20200103173238.9598-1-rekado@elephly.net> Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807292931640 (code B ref 38902); Fri, 03 Jan 2020 17:36:02 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:29 +0000 Received: from localhost ([127.0.0.1]:41384 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQr5-0008E0-Pd for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:28 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQr2-0008Dp-9j for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:22 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072917; cv=none; d=zohomail.com; s=zohoarc; b=jqF67Nuhs47T1+Ohp2NMGqPVCCOJnMsxvMMrr/Y2a5sQLWMg54dv36zn5lcXZaRFngS9X4koRtqyjaIRg6TUHjdaVr/CqbRNGsD4zqLXdd3h/nVzi9hhftouarjipl8DlaXTMEJO+tGeS3IShyUn+zX559VlWTM5OtOd9Guzo1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072917; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=TTh39Rh8/1I+egVgOSMjSZc8uiPJxW/NDtZB1AoGxx8=; b=HDYgkIgFZae1HgM7Wdab6DTYNkQFmZtrzD0iyaa9YJuZPAd9rCMrfc2O3BJ2YP9nNbTDi5SfjifkqTPaUKwRAuHLxThcxN0zD5YMGJrf/AuzsDT3dNU/EnZiCpWpsC/hHy8KDnGc9XgK4NVFTqvg1hy7a4TdjZzTPAj2r/ALSKo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072917; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=TTh39Rh8/1I+egVgOSMjSZc8uiPJxW/NDtZB1AoGxx8=; b=JFs/ykj3eQsU9i1kn7nwL2krh22Ncutt1zfnDJDbDUbe8I6iGP4kFgPIn+C/9wga i9QWZ2M2JoGqaogpn69bk2KFY1bzz4bMbMiGzrGWEoHYCTZrdrsxyLZ/UMx9uaCnxxG JeAR1ua+6l+EsPoKAPPEbfLSE0GEvWoaCEwjMelU= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072913825720.9531185890306; Fri, 3 Jan 2020 09:35:13 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-1-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:34:58 +0100 X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/nfs.scm (nfs-utils): Update to 2.4.2. [source]: Remove patch. [arguments]: Update configure flags, remove fix-glibc-compatability phase, update substitutions. [inputs]: Add keyutils and rpcsvc-proto. * gnu/packages/patches/nfs-utils-missing-headers.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Remove it. --- gnu/local.mk | 1 - gnu/packages/nfs.scm | 45 ++++++++++--------- .../patches/nfs-utils-missing-headers.patch | 19 -------- 3 files changed, 25 insertions(+), 40 deletions(-) delete mode 100644 gnu/packages/patches/nfs-utils-missing-headers.patch diff --git a/gnu/local.mk b/gnu/local.mk index c7dcc65082..bfdaba2761 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1198,7 +1198,6 @@ dist_patch_DATA = \ %D%/packages/patches/netsurf-system-utf8proc.patch \ %D%/packages/patches/netsurf-y2038-tests.patch \ %D%/packages/patches/netsurf-longer-test-timeout.patch \ - %D%/packages/patches/nfs-utils-missing-headers.patch \ %D%/packages/patches/ngircd-handle-zombies.patch \ %D%/packages/patches/nm-plugin-path.patch \ %D%/packages/patches/nsis-env-passthru.patch \ diff --git a/gnu/packages/nfs.scm b/gnu/packages/nfs.scm index 9d7acc3592..a3d5383c4d 100644 --- a/gnu/packages/nfs.scm +++ b/gnu/packages/nfs.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016 John Darrington ;;; Copyright © 2017, 2018 Leo Famulari ;;; Copyright © 2018 Efraim Flashner +;;; Copyright © 2020 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +21,7 @@ (define-module (gnu packages nfs) #:use-module (gnu packages) + #:use-module (gnu packages crypto) #:use-module (gnu packages linux) #:use-module (gnu packages libevent) #:use-module (gnu packages kerberos) @@ -42,32 +44,27 @@ (define-public nfs-utils (package (name "nfs-utils") - (version "2.1.1") + (version "2.4.2") (source (origin (method url-fetch) (uri (string-append "mirror://kernel.org/linux/utils/nfs-utils/" version "/nfs-utils-" version ".tar.xz")) - (patches (search-patches "nfs-utils-missing-headers.patch")) (sha256 (base32 - "1vqrqzhg9nh2wj1icp7k8v9dibgnn521b45np79nnkmqf16bbbhg")))) + "0f0hm8jq1p5gra55v621qpbb3mryakaikzpy5znkvxym0dx76r24")))) (build-system gnu-build-system) (arguments `(#:configure-flags `("--without-tcp-wrappers" ,(string-append "--with-start-statd=" (assoc-ref %outputs "out") "/sbin/start-statd") - ,(string-append "--with-krb5=" (assoc-ref %build-inputs "mit-krb5"))) + ,(string-append "--with-krb5=" (assoc-ref %build-inputs "mit-krb5")) + ,(string-append "--with-pluginpath=" + (assoc-ref %outputs "out") + "/lib/libnfsidmap")) #:phases (modify-phases %standard-phases - (add-after 'unpack 'fix-glibc-compatability - (lambda _ - (substitute* '("utils/blkmapd/device-discovery.c" - "utils/blkmapd/dm-device.c") - (("") - "\n#include ")) - #t)) (add-before 'configure 'adjust-command-file-names (lambda _ ;; Remove assumptions of FHS from start-statd script @@ -81,6 +78,11 @@ (string-append "exec " (assoc-ref %outputs "out") "/sbin/rpc.statd"))) + ;; find rpcgen + (substitute* "configure" + (("/usr/local/bin/rpcgen") + (which "rpcgen"))) + ;; This hook tries to write to /var ;; That needs to be done by a service too. (substitute* `("Makefile.in") @@ -96,20 +98,23 @@ (substitute* `("utils/statd/statd.c") (("/usr/sbin/") (string-append (assoc-ref %outputs "out") "/sbin/"))) - (substitute* `("utils/osd_login/Makefile.in" - "utils/mount/Makefile.in" + (substitute* `("utils/mount/Makefile.in" + "utils/nfsdcld/Makefile.in" "utils/nfsdcltrack/Makefile.in") (("^sbindir = /sbin") (string-append "sbindir = " (assoc-ref %outputs "out") "/sbin"))) #t))))) - (inputs `(("libevent" ,libevent) - ("libnfsidmap" ,libnfsidmap) - ("sqlite" ,sqlite) - ("lvm2" ,lvm2) - ("util-linux" ,util-linux) - ("mit-krb5" ,mit-krb5) - ("libtirpc" ,libtirpc))) + (inputs + `(("keyutils" ,keyutils) + ("libevent" ,libevent) + ("libnfsidmap" ,libnfsidmap) + ("rpcsvc-proto" ,rpcsvc-proto) ;for 'rpcgen' + ("sqlite" ,sqlite) + ("lvm2" ,lvm2) + ("util-linux" ,util-linux) + ("mit-krb5" ,mit-krb5) + ("libtirpc" ,libtirpc))) (native-inputs `(("pkg-config" ,pkg-config))) (home-page "http://www.kernel.org/pub/linux/utils/nfs-utils/") diff --git a/gnu/packages/patches/nfs-utils-missing-headers.patch b/gnu/packages/patches/nfs-utils-missing-headers.patch deleted file mode 100644 index 7f0542836e..0000000000 --- a/gnu/packages/patches/nfs-utils-missing-headers.patch +++ /dev/null @@ -1,19 +0,0 @@ -Fix compilation failure with glibc 2.26 caused by missing type -declarations: - ------- -rpc.c: In function ‘nsm_recv_getport’: -rpc.c:469:13: error: ‘UINT16_MAX’ undeclared (first use in this function) - if (port > UINT16_MAX) { ------- - ---- a/support/nsm/rpc.c.orig 2016-08-03 20:25:15.000000000 +0200 -+++ b/support/nsm/rpc.c 2017-08-26 07:41:11.884000000 +0200 -@@ -40,6 +40,7 @@ - - #include - #include -+#include - #include - #include - #include From patchwork Fri Jan 3 17:34:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19556 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 60583179EA; Fri, 3 Jan 2020 17:36:19 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 26E8617979 for ; Fri, 3 Jan 2020 17:36:19 +0000 (GMT) Received: from localhost ([::1]:55238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrx-000789-M1 for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37337) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrk-000773-4A for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrj-00037T-5Q for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35436) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrj-00036D-0j for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQri-0008Gi-Ud for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 2/9] services: nfs: Fix name of package variable. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807292931648 (code B ref 38902); Fri, 03 Jan 2020 17:36:02 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:29 +0000 Received: from localhost ([127.0.0.1]:41388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrB-0008EH-0c for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:29 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21147) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQr5-0008Dy-PZ for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:24 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072921; cv=none; d=zohomail.com; s=zohoarc; b=RuKpQe25YCdIcKAsnWAjYrEQC7BUUYrQ4BvXYgWO6RTPmY2x9Uj/5nrAtsaWcR4+byat+FtKvg4KeYlBwozQpfKnemPT8y0IggsCU+0iG+z7GyVDLnKoUz9aMuQqxnOcQu6Petu8IaU3lyWD4twTet1Ru73m9fvSphKotEOu8Xo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072921; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=KLH8ABYRG0/YPTOX64gYNgidQGWFeDESr1sAIDVc7no=; b=dzXrqjEewy7OW6xE/kM6E5j6cU7akZG1TYTYfC4ENQMGQV3KYCFLveE8mMOp74knSXwPkA6FXImEYuwwvxNYpr8D9D67HTEdqJWMkfbhrI6Lg5VtozHJwV7PFpx6eDxj4IdqtTWAd2JsKYBpp7EKkCEmZOZOKO+bwx+PefuS4XY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072921; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=KLH8ABYRG0/YPTOX64gYNgidQGWFeDESr1sAIDVc7no=; b=Nntx3Ee4DUWCmgWfbWw5jLjV0u7pEVAdWkGwqnMslg06LD/2OzeOsDWZaC1P+XXj /tUNPIO5e5JChy3jEREYM5xBwvzKwl7vzfwcnEVUrtK2Fg9+2sRi2wvK9WIu+SUgLsp 7f7OrZtaxP4Bjec5PYVF16rDlQqpnLkPEho/lBMs= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072918491669.1295456720442; Fri, 3 Jan 2020 09:35:18 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-2-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:34:59 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (rpcbind-service-type): Correct name from nfs-utils to rpcbind. --- gnu/services/nfs.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 6ed4c0eabf..834e94a800 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 John Darrington +;;; Copyright © 2018, 2019, 2020 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -58,11 +59,11 @@ (shepherd-service-type 'rpcbind (lambda (config) - (define nfs-utils + (define rpcbind (rpcbind-configuration-rpcbind config)) (define rpcbind-command - #~(list (string-append #$nfs-utils "/bin/rpcbind") "-f" + #~(list (string-append #$rpcbind "/bin/rpcbind") "-f" #$@(if (rpcbind-configuration-warm-start? config) '("-w") '()))) (shepherd-service From patchwork Fri Jan 3 17:35:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19558 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id E36B6179EA; Fri, 3 Jan 2020 17:36:32 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id A894117979 for ; Fri, 3 Jan 2020 17:36:32 +0000 (GMT) Received: from localhost ([::1]:55242 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsB-0007Ft-LQ for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37407) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrk-000777-W9 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrj-0003AP-Le for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35437) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrj-000398-H0 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrj-0008Gp-CR for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 3/9] services: nfs: Allow rpcbind-service-type to be extended. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807292931654 (code B ref 38902); Fri, 03 Jan 2020 17:36:03 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:29 +0000 Received: from localhost ([127.0.0.1]:41390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrB-0008EP-Aa for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:29 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQr9-0008E9-Q7 for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:28 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072925; cv=none; d=zohomail.com; s=zohoarc; b=XO9vfyDOP21NnDwzzvs7I2wB3rcSROmp1Cs+6DwbqFWbZLy9oFZLRFaDWBGwxY9FD0vTkTjxYw3r3ptmvk8HQ0Uo2WU+DaVpyrCKGRGMcBsB1P9ZoxzeYVxt7CLZthVdGeKt1lkIrPwVEjIVENct6yTnk07yAuQ3rMlJotIrWl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072925; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=o4My4sRhsNLyOe9QG+vg2+k5MYXQHMdSdnPgCsW5Nos=; b=QvMu3qDAS89W3rR6qP9hRUfFbKktgVymwSZpml+swqjc2EjB3d47SYjahvw2kUqZI6GqTuEnHljeDrFBqce+U1OD1FMfIXDQ+vlK6owxBQJrq+YrKcyGMU0Vb7Rmq9WtkkstsTtVurDcUPHGUTAM71DJrq1zD8l54C3qaIdhl7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072925; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=o4My4sRhsNLyOe9QG+vg2+k5MYXQHMdSdnPgCsW5Nos=; b=MKZdYXh4zrfYriCrR3Ah3b2GjDrN9ES7E43K93BZgf8DcRsPN42Nv6wSfkccTgAG 4f9i7X11M24bkS7GtN45THowypuU+BD+VTAfzrKykAc2bfKHtuaL0Odpyxrwo23Jp4c GxxuW9qTGIVUph4qFcMG8/iGBu2Bq7MPKLTF3N0A= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072922622931.5578194081803; Fri, 3 Jan 2020 09:35:22 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-3-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:00 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (rpcbind-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 47 ++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 834e94a800..0681e764ec 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -56,23 +56,36 @@ (default #t))) (define rpcbind-service-type - (shepherd-service-type - 'rpcbind - (lambda (config) - (define rpcbind - (rpcbind-configuration-rpcbind config)) - - (define rpcbind-command - #~(list (string-append #$rpcbind "/bin/rpcbind") "-f" - #$@(if (rpcbind-configuration-warm-start? config) '("-w") '()))) - - (shepherd-service - (documentation "Start the RPC bind daemon.") - (requirement '(networking)) - (provision '(rpcbind-daemon)) - - (start #~(make-forkexec-constructor #$rpcbind-command)) - (stop #~(make-kill-destructor)))))) + (let ((proc + (lambda (config) + (define rpcbind + (rpcbind-configuration-rpcbind config)) + + (define rpcbind-command + #~(list (string-append #$rpcbind "/bin/rpcbind") "-f" + #$@(if (rpcbind-configuration-warm-start? config) '("-w") '()))) + + (shepherd-service + (documentation "Start the RPC bind daemon.") + (requirement '(networking)) + (provision '(rpcbind-daemon)) + + (start #~(make-forkexec-constructor #$rpcbind-command)) + (stop #~(make-kill-destructor)))))) + (service-type + (name 'rpcbind) + (extensions + (list (service-extension shepherd-root-service-type + (compose list proc)))) + ;; We use the extensions feature to allow other services to automatically + ;; configure and start this service. Only one value can be provided. We + ;; override it with the value returned by the extending service. + (compose identity) + (extend (lambda (config values) + (match values + ((first . rest) first) + (_ config)))) + (default-value (rpcbind-configuration))))) From patchwork Fri Jan 3 17:35:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19561 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4AB0F17979; Fri, 3 Jan 2020 17:36:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 0FA2417979 for ; Fri, 3 Jan 2020 17:36:41 +0000 (GMT) Received: from localhost ([::1]:55248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsK-0007WN-E3 for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37452) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrl-00077B-F1 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrk-0003Cj-3y for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35438) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrj-0003Ba-ST for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrj-0008Gx-QG for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 4/9] services: nfs: Allow pipefs-service-type to be extended. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807293331676 (code B ref 38902); Fri, 03 Jan 2020 17:36:03 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:33 +0000 Received: from localhost ([127.0.0.1]:41393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrF-0008Ep-JU for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:33 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrD-0008Ef-Q8 for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:32 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072929; cv=none; d=zohomail.com; s=zohoarc; b=aP5Ts44eRvrA17uDE9MLUCyWcjBNS4lxVmxhqnNzMbElPrKzRPQ2+Kr6H6HCiwtJeOt0HbAsg/TqIGoyfkD4Pg4k63c2yEBY3GF+d3KU72xfXu1u9WFFvciaFW1/yu9RvKsD76z8M10CkmccPNKGNT64EAY1BrJ6zq8DPK3V74I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072929; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=5YthAeQPn05rEtRBi3MOB1thMHytLr1DmnmYxJnfQws=; b=nTzFZXMa0JkQuFd4ul9V83N/MHwHHWBeoKeJJnSIhYKhbo4IQwp6el2w1IXOMM0KnddARg/W3WSTtFF8fdRmDo5W5KEjgQgaP1wtKcJwg20ZVCIt1HSuZbgoAOb6I3t5vrc64iCMf/8385zBgDWLEj5V/UeG98kCgdqeGkHyoVM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072929; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=5YthAeQPn05rEtRBi3MOB1thMHytLr1DmnmYxJnfQws=; b=O4Bx3AwwQzyg9CzPu3Pixa/M4PnWMW+j8VNImIVRl9mXktfKQ0tRQtwaRuMxf+Sv XOxdbWolKr65Z+oYIfpft4NXH1K63cj3cAaGyAEuxjKvsdiqo7p8Ay+UReS0cBQWzB1 2gk1bdhbf0PmcG34n978LT3MJysh7Dl6rZpdInw8= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072926833808.040745756275; Fri, 3 Jan 2020 09:35:26 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-4-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:01 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (pipefs-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 0681e764ec..1b5dcb0e97 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -24,6 +24,7 @@ #:use-module (gnu packages linux) #:use-module (guix) #:use-module (guix records) + #:use-module (srfi srfi-1) #:use-module (ice-9 match) #:use-module (gnu build file-systems) #:export (rpcbind-service-type @@ -96,23 +97,33 @@ (default default-pipefs-directory))) (define pipefs-service-type - (shepherd-service-type - 'pipefs - (lambda (config) - (define pipefs-directory (pipefs-configuration-mount-point config)) + (let ((proc + (lambda (config) + (define pipefs-directory (pipefs-configuration-mount-point config)) - (shepherd-service - (documentation "Mount the pipefs pseudo file system.") - (provision '(rpc-pipefs)) + (shepherd-service + (documentation "Mount the pipefs pseudo file system.") + (provision '(rpc-pipefs)) - (start #~(lambda () - (mkdir-p #$pipefs-directory) - (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs") - (member #$pipefs-directory (mount-points)))) + (start #~(lambda () + (mkdir-p #$pipefs-directory) + (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs") + (member #$pipefs-directory (mount-points)))) - (stop #~(lambda (pid . args) - (umount #$pipefs-directory MNT_DETACH) - (not (member #$pipefs-directory (mount-points))))))))) + (stop #~(lambda (pid . args) + (umount #$pipefs-directory MNT_DETACH) + (not (member #$pipefs-directory (mount-points))))))))) + (service-type + (name 'pipefs) + (extensions + (list (service-extension shepherd-root-service-type + (compose list proc)))) + ;; We use the extensions feature to allow other services to automatically + ;; configure and start this service. Only one value can be provided. We + ;; override it with the value returned by the extending service. + (compose identity) + (extend (lambda (config values) (first values))) + (default-value (pipefs-configuration))))) From patchwork Fri Jan 3 17:35:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19557 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 50E7D179EA; Fri, 3 Jan 2020 17:36:29 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 198F417979 for ; Fri, 3 Jan 2020 17:36:29 +0000 (GMT) Received: from localhost ([::1]:55240 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQs8-0007Bx-JC for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:28 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37469) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrl-00077G-L0 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrk-0003F2-HW for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrk-0003Dw-BM for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrk-0008H4-88 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 5/9] services: nfs: Fix indentation and typo. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807293831692 (code B ref 38902); Fri, 03 Jan 2020 17:36:04 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:38 +0000 Received: from localhost ([127.0.0.1]:41396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrJ-0008F6-Sy for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:38 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21159) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrH-0008Ey-Pu for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:36 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072933; cv=none; d=zohomail.com; s=zohoarc; b=JDp+aLLO3TVgjylkCHk2YCc9gLYXTPRMeslpWAUaWOGo9X0YoJh5EfDiCEXUATl6u5AzzT5r4gHTArviWpsN6C9AwHDcuFyCiTBF6t1iVSGM7VKQLEA7NXVVuSNRKVbQFqNY3OPnJFJs8EsE7pf/x2dAq3d8IXph11XreE89In8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072933; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=M2Bmr5UMR+ThJ+37ql4Uet1v3d45VI/WyVzvZbrSGho=; b=aPXFMZcxIJKUI1NzULODS9GcO+WRM4HDuRXjC/X+9HPz2AJjbz+LqmdxSsM9D4KnB05f+inoKTtPnHOpUC8or/o8rQouU8QNFXdv0+hIF7aPc8Xkxc7m67l8xwT/b1FHtjBUsd+zELkucnPU2sA66r7B0E33fYdvfC/X6PLUuNc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072933; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=M2Bmr5UMR+ThJ+37ql4Uet1v3d45VI/WyVzvZbrSGho=; b=JyiJQTxMzRSmufMOouxtv+X+drBKNZDPNo5XKPFHmK1I71UfYB3sPE31s7LIQ5f6 +YSwFA3UOn1VLmR3G3RNiu9qoSOH3p23kT/Hl7h0JyV42BZK1KaiWu19VwLH08/8lOJ lNJ+x753CkPpFtc5fWhUfWfqiBjWqp2RMD2OdO+o= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072930920899.2277800043591; Fri, 3 Jan 2020 09:35:30 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-5-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:02 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (, ): Fix indentation. (): Rename accessor for NFS-UTILS field to IDMAP-CONFIGURATION-NFS-UTILS. (idmap-service-type): Use IDMAP-CONFIGURATION-NFS-UTILS. --- gnu/services/nfs.scm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 1b5dcb0e97..451020be31 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -130,7 +130,7 @@ (define-record-type* gss-configuration make-gss-configuration gss-configuration? - (pipefs-directory gss-configuration-pipefs-directory + (pipefs-directory gss-configuration-pipefs-directory (default default-pipefs-directory)) (nfs-utils gss-configuration-gss (default nfs-utils))) @@ -162,11 +162,11 @@ (define-record-type* idmap-configuration make-idmap-configuration idmap-configuration? - (pipefs-directory idmap-configuration-pipefs-directory + (pipefs-directory idmap-configuration-pipefs-directory (default default-pipefs-directory)) (domain idmap-configuration-domain - (default #f)) - (nfs-utils idmap-configuration-idmap + (default #f)) + (nfs-utils idmap-configuration-nfs-utils (default nfs-utils))) (define idmap-service-type @@ -175,7 +175,7 @@ (lambda (config) (define nfs-utils - (idmap-configuration-idmap config)) + (idmap-configuration-nfs-utils config)) (define pipefs-directory (idmap-configuration-pipefs-directory config)) From patchwork Fri Jan 3 17:35:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19563 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 13398179EB; Fri, 3 Jan 2020 17:36:48 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id CA0F117979 for ; Fri, 3 Jan 2020 17:36:47 +0000 (GMT) Received: from localhost ([::1]:55256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsR-0007qb-6a for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37539) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrm-00078T-CD for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrk-0003HE-Tk for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrk-0003G5-O4 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrk-0008HB-LM for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 6/9] services: nfs: Allow idmap-service-type to be extended. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807294231709 (code B ref 38902); Fri, 03 Jan 2020 17:36:04 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:42 +0000 Received: from localhost ([127.0.0.1]:41399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrO-0008FN-4R for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:42 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21163) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrL-0008FF-V8 for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:40 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072937; cv=none; d=zohomail.com; s=zohoarc; b=Ugz3nU//QFD5PrwooEk8JEx9GvnfVx2rg3/M7Y/CkGW3UQzPm93xrLkN8CXvYJ6U9gWtCs67pw9akv15RzPKZtLC4X0NyuxAIKMM2cyDM8KIHJe6GnK9Hc0cSR7zkZmS8PP5ORWZzb/GB//KQG2n0I4YJ7GpXMUqPqtcaq3zCNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072937; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/6Dm6p95FEyshdRfln2/V+9DsqWH8/rSf9pTcR+PF18=; b=FlGkexcukYHG4hDAKbGdq5HE7PcaL1l5Jq9/Zg7zMDrvbRYAYm5BQUekznFKaREqIQpwAzYU4SwhjBGcSsj76hoIZHwBePCdqYIfwxCkrrKfcMz/nMLpue4BoB6lLDPm62hPCkf8mb7NHecSRgSTUyygD39Fs5OXqZgh3l0UN6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072937; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=/6Dm6p95FEyshdRfln2/V+9DsqWH8/rSf9pTcR+PF18=; b=QOXrgahQWb6FnkoMX57LoLhaw7F5FqG/wS2JH0ICVb5mBJl0auESjYQ2/vJojb4k lzXuoKN1QuvbB0vcDXgQj3cRi84Bl8Pp+EY6ZnJGmZdVVaQtjTw2xJWy6vzhouaB80R 17Dx3DY/kEglvGYNVEltaj2NebDje79bHskuqSHg= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072935167765.4979943978356; Fri, 3 Jan 2020 09:35:35 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-6-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:03 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (idmap-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 67 ++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 451020be31..9fb95bde7e 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -170,37 +170,48 @@ (default nfs-utils))) (define idmap-service-type - (shepherd-service-type - 'idmap - (lambda (config) - - (define nfs-utils - (idmap-configuration-nfs-utils config)) + (let ((proc + (lambda (config) - (define pipefs-directory - (idmap-configuration-pipefs-directory config)) + (define nfs-utils + (idmap-configuration-nfs-utils config)) - (define domain (idmap-configuration-domain config)) + (define pipefs-directory + (idmap-configuration-pipefs-directory config)) - (define (idmap-config-file config) - (plain-file "idmapd.conf" - (string-append - "\n[General]\n" - (if domain - (format #f "Domain = ~a\n" domain)) - "\n[Mapping]\n" - "Nobody-User = nobody\n" - "Nobody-Group = nogroup\n"))) + (define domain (idmap-configuration-domain config)) - (define idmap-command - #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f" - "-p" #$pipefs-directory - "-c" #$(idmap-config-file config))) + (define (idmap-config-file config) + (plain-file "idmapd.conf" + (string-append + "\n[General]\n" + (if domain + (format #f "Domain = ~a\n" domain) + "") + "\n[Mapping]\n" + "Nobody-User = nobody\n" + "Nobody-Group = nogroup\n"))) - (shepherd-service - (documentation "Start the RPC IDMAP daemon.") - (requirement '(rpcbind-daemon rpc-pipefs)) - (provision '(idmap-daemon)) - (start #~(make-forkexec-constructor #$idmap-command)) - (stop #~(make-kill-destructor)))))) + (define idmap-command + #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f" + "-p" #$pipefs-directory + ;; TODO: this is deprecated + "-c" #$(idmap-config-file config))) + (shepherd-service + (documentation "Start the RPC IDMAP daemon.") + (requirement '(rpcbind-daemon rpc-pipefs)) + (provision '(idmap-daemon)) + (start #~(make-forkexec-constructor #$idmap-command)) + (stop #~(make-kill-destructor)))))) + (service-type + (name 'idmap) + (extensions + (list (service-extension shepherd-root-service-type + (compose list proc)))) + ;; We use the extensions feature to allow other services to automatically + ;; configure and start this service. Only one value can be provided. We + ;; override it with the value returned by the extending service. + (compose identity) + (extend (lambda (config values) (first values))) + (default-value (idmap-configuration))))) From patchwork Fri Jan 3 17:35:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19562 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 615A2179EA; Fri, 3 Jan 2020 17:36:42 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 2CFEF17979 for ; Fri, 3 Jan 2020 17:36:42 +0000 (GMT) Received: from localhost ([::1]:55250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsL-0007dM-IH for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37581) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrm-00079Z-Se for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrl-0003Jm-Cz for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35441) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrl-0003IO-5M for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrl-0008HJ-2m for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 7/9] services: nfs: Add verbosity control to idmap-service-type. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807294531728 (code B ref 38902); Fri, 03 Jan 2020 17:36:05 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:45 +0000 Received: from localhost ([127.0.0.1]:41402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrR-0008Fg-DL for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:45 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrP-0008FW-Pj for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:44 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072941; cv=none; d=zohomail.com; s=zohoarc; b=VKoNZK2be8wkBuZBJqlSYVNjZPKrwzFNL59KYSQV9sF+zKOahhTaWP6MpDV5ybs4AUkjelz5n6NnuQVg4Zcq6A0PPFYYuj3MzA/hH1rOxK+cGi/V2VRLrLnbVBarFefkDBRPED+0pJX7YGBR77OkRbvavYEbWVUN1msc0QbaU4g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072941; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=IvlPM5W8v9firrVsU1VJ4h0cKhus/G1TXS4O1c2jItQ=; b=Lwqwd1Evv5RCbG0qy+VAevbztpLm9HgmGp9snUkb/jbkhqjRlKHI62Cw6O42B1NjoTESMmbICTn8MUuEcQJcMxnLhkK21mj1J0Q8N4k6H7VGVyWLNXNo/+gbNTiuQCvYQWpPehH/J455fEre+udwCy1KYYbGGl9O2kWicvqXc8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072941; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=IvlPM5W8v9firrVsU1VJ4h0cKhus/G1TXS4O1c2jItQ=; b=NWl2MKuQrIV43pzWkFcLktW5SzrBP686s10gQ0LGQIIK7PKOnmWw1qaut9kXZuVf 9YgUnfPItGUQS/QmCE0QEV1m+SqbB1Issz6DV19vY1dTbii5l48WqkpUcjVuFhc/12W XsC2BY8qb2MVI7ZUGpDJGL/HENb7xNZitJ/eclkk= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072939253788.4490502714638; Fri, 3 Jan 2020 09:35:39 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-7-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:04 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm ()[verbosity]: New field. (idmap-configuration-verbosity): New procedure. (idmap-service-type): Use it. * doc/guix.texi (Network File System): Document it. --- doc/guix.texi | 3 +++ gnu/services/nfs.scm | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 70e3dfea6a..a26056899e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -22030,6 +22030,9 @@ The local NFSv4 domain name. This must be a string or @code{#f}. If it is @code{#f} then the daemon will use the host's fully qualified domain name. +@item @code{verbosity} (default: @code{0}) +The verbosity level of the daemon. + @end table @end deftp diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 9fb95bde7e..054dad08b6 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -167,7 +167,9 @@ (domain idmap-configuration-domain (default #f)) (nfs-utils idmap-configuration-nfs-utils - (default nfs-utils))) + (default nfs-utils)) + (verbosity idmap-configuration-verbosity + (default 0))) (define idmap-service-type (let ((proc @@ -185,6 +187,10 @@ (plain-file "idmapd.conf" (string-append "\n[General]\n" + "Verbosity = " + (number->string + (idmap-configuration-verbosity config)) + "\n" (if domain (format #f "Domain = ~a\n" domain) "") From patchwork Fri Jan 3 17:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19559 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 948B2179EA; Fri, 3 Jan 2020 17:36:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 52A2C17979 for ; Fri, 3 Jan 2020 17:36:33 +0000 (GMT) Received: from localhost ([::1]:55244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsC-0007GW-AZ for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37598) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQrn-0007A0-48 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrl-0003LL-PB for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35442) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrl-0003KT-JD for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrl-0008HQ-FG for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 8/9] services: nfs: Allow gss-service-type to be extended. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807294931745 (code B ref 38902); Fri, 03 Jan 2020 17:36:05 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:49 +0000 Received: from localhost ([127.0.0.1]:41405 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrV-0008Fx-L2 for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:49 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrT-0008Fp-QV for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:48 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072945; cv=none; d=zohomail.com; s=zohoarc; b=Iy6tSxlz35buNfWfOrcydPOkUlM4e4RYp7CXhL4m5m1tpNpl2qiZZ3iCgnY2nzcA9LyIMo0Oq4VI6huDwAHLLhPIL8iXr4aEMWGsjQv6AS04dd6S9mBjZEjS1KQb0FqgqHNceohDF6ErR/jbhdHCsP7jGuMX2fu4XfWheaHmD28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=zBhaiPmT62PdvWfauu6GmkOCrThg9Vf5IIgba+c5Ruc=; b=hobzP3f8qdO7s5AU4se6A36PXBOZKUzMREQ4GQKaaMQOA/HriEawI17e0VaQRm7iZdeGHxZC+Lu9QAjgQR8kEpdKg0MlKrT6EywvZzyTVPLnbKTVyD1WVlXKeYV/bhNHYkj8gFxuB088OkciOAP/TwEZ8hS05lB8PjkQw0xNELA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072945; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type; bh=zBhaiPmT62PdvWfauu6GmkOCrThg9Vf5IIgba+c5Ruc=; b=Jn6vogciL6VUCmntm6Rq5qss9vMLbwdUCt7AvGtktyn2G1EUmD8+gplzH3FVP0Xt Ay1Q2nva2hwt3ND4+NBJzmzDbRZT0pRUXSZ6Fo2SFCf94uGled4CAF7fCdnJ2/qxf+n cXtLjtXS+GI7tVV6vy1WxIZoIuvxSqEUaBDIL8pU= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072943374249.066292277691; Fri, 3 Jan 2020 09:35:43 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-8-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:05 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (gss-service-type): Rewrite using SERVICE-TYPE to add ability to extend the service. --- gnu/services/nfs.scm | 53 +++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index 054dad08b6..cd7e8fab01 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -136,26 +136,39 @@ (default nfs-utils))) (define gss-service-type - (shepherd-service-type - 'gss - (lambda (config) - (define nfs-utils - (gss-configuration-gss config)) - - (define pipefs-directory - (gss-configuration-pipefs-directory config)) - - (define gss-command - #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f" - "-p" #$pipefs-directory)) - - (shepherd-service - (documentation "Start the RPC GSS daemon.") - (requirement '(rpcbind-daemon rpc-pipefs)) - (provision '(gss-daemon)) - - (start #~(make-forkexec-constructor #$gss-command)) - (stop #~(make-kill-destructor)))))) + (let ((proc + (lambda (config) + (define nfs-utils + (gss-configuration-gss config)) + + (define pipefs-directory + (gss-configuration-pipefs-directory config)) + + (define gss-command + #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f" + "-p" #$pipefs-directory)) + + (shepherd-service + (documentation "Start the RPC GSS daemon.") + (requirement '(rpcbind-daemon rpc-pipefs)) + (provision '(gss-daemon)) + + (start #~(make-forkexec-constructor #$gss-command)) + (stop #~(make-kill-destructor)))))) + (service-type + (name 'gss) + (extensions + (list (service-extension shepherd-root-service-type + (compose list proc)))) + ;; We use the extensions feature to allow other services to automatically + ;; configure and start this service. Only one value can be provided. We + ;; override it with the value returned by the extending service. + (compose identity) + (extend (lambda (config values) + (match values + ((first . rest) first) + (_ config)))) + (default-value (gss-configuration))))) From patchwork Fri Jan 3 17:35:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ricardo Wurmus X-Patchwork-Id: 19564 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8914E179E4; Fri, 3 Jan 2020 17:36:49 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id D4A18179EA for ; Fri, 3 Jan 2020 17:36:48 +0000 (GMT) Received: from localhost ([::1]:55258 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQsS-0007rf-By for patchwork@mira.cbaines.net; Fri, 03 Jan 2020 12:36:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37744) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inQro-0007DE-S4 for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inQrm-0003Np-7Y for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35443) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inQrm-0003M5-0a for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inQrl-0008HX-SE for guix-patches@gnu.org; Fri, 03 Jan 2020 12:36:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38902] [PATCH 9/9] services: nfs: Add nfs-service-type. Resent-From: Ricardo Wurmus Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Jan 2020 17:36:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38902 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38902@debbugs.gnu.org Cc: Ricardo Wurmus Received: via spool by 38902-submit@debbugs.gnu.org id=B38902.157807295431762 (code B ref 38902); Fri, 03 Jan 2020 17:36:05 +0000 Received: (at 38902) by debbugs.gnu.org; 3 Jan 2020 17:35:54 +0000 Received: from localhost ([127.0.0.1]:41408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrZ-0008GE-UG for submit@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:54 -0500 Received: from sender4-of-o51.zoho.com ([136.143.188.51]:21169) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inQrX-0008G6-WF for 38902@debbugs.gnu.org; Fri, 03 Jan 2020 12:35:52 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1578072949; cv=none; d=zohomail.com; s=zohoarc; b=H062LegBRZsnAQ2/duG1d3aHTXWg6GbYJjp7BIq1B7oBl7YoTXtGJ53CAeEAhbCrRxNeKIucgXDolXQlCCTJYY7pU1kEUjWgJYjEUpU9cbFjWZoWYfTpUFbS9a8T5OyhugzIdIviURnjOxhlbGbyWnZ1/upXmvb2KNNtAFXIu40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578072949; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=/SlfAPWfOi4+znDeeVHkbGDk/qp03aUKx49AlN+41WE=; b=kPCeQeJoREOAWadjTrFuQzE/TGXpXvuT0enyM6ZX/IMCS/J3H9scoLZfxrs667/G/BPiDWqJPc4FV0kmz+q65lJRZP46iU8pyl0VwYv37HCn4jXnPnxjyhvpWpxQGQQQoJx47IjenxWO9naO4aTpV8yER0c0RxquCUHRMLb1VJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1578072949; s=zoho; d=elephly.net; i=rekado@elephly.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; bh=/SlfAPWfOi4+znDeeVHkbGDk/qp03aUKx49AlN+41WE=; b=Wu9IQe1xKVciRvwcjdU88pL20dMl486zfeaJyBVAsvdiAjCuAoSrjpEbaZT5jLNM SgCsMMW5F/7unS9xZFlWrjqawTs/SVCg/iqz8EUKZYr+oVEXUwkkZhJsCOsGjFOlB8G Nk4/9UNAkW3WH0OR3mGKGfh7t+d94lFtZL37XJ+w= Received: from localhost (p54AD4FBF.dip0.t-ipconnect.de [84.173.79.191]) by mx.zohomail.com with SMTPS id 1578072947678340.83146508294124; Fri, 3 Jan 2020 09:35:47 -0800 (PST) From: Ricardo Wurmus Message-ID: <20200103173506.9779-9-rekado@elephly.net> Date: Fri, 3 Jan 2020 18:35:06 +0100 X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200103173506.9779-1-rekado@elephly.net> References: <20200103173506.9779-1-rekado@elephly.net> MIME-Version: 1.0 X-ZohoMailClient: External X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/services/nfs.scm (): New record. (nfs-configuration, nfs-configuration?, nfs-configuration-nfs-utils, nfs-configuration-nfs-version, nfs-configuration-exports, nfs-configuration-rpcmountd-port, nfs-configuration-rpcstatd-port, nfs-configuration-rpcbind, nfs-configuration-idmap-domain, nfs-configuration-nfsd-port, nfs-configuration-nfsd-threads, nfs-configuration-pipefs-directory, nfs-configuration-debug, nfs-shepherd-services): New procedures. (nfs-service-type): New variable. * doc/guix.texi (Network File System): Document it. * gnu/tests/nfs.scm (%test-nfs-server): New variable. (%base-os): Use default value of rpcbind-service-type. --- doc/guix.texi | 74 +++++++++++++++++- gnu/services/nfs.scm | 181 ++++++++++++++++++++++++++++++++++++++++++- gnu/tests/nfs.scm | 157 ++++++++++++++++++++++++++++++++++++- 3 files changed, 407 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index a26056899e..8eb31e54df 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -29,7 +29,7 @@ Copyright @copyright{} 2015, 2016 Mathieu Lirzin@* Copyright @copyright{} 2014 Pierre-Antoine Rault@* Copyright @copyright{} 2015 Taylan Ulrich Bayırlı/Kammer@* Copyright @copyright{} 2015, 2016, 2017, 2019 Leo Famulari@* -Copyright @copyright{} 2015, 2016, 2017, 2018, 2019 Ricardo Wurmus@* +Copyright @copyright{} 2015, 2016, 2017, 2018, 2019, 2020 Ricardo Wurmus@* Copyright @copyright{} 2016 Ben Woodcroft@* Copyright @copyright{} 2016, 2017, 2018 Chris Marusich@* Copyright @copyright{} 2016, 2017, 2018, 2019 Efraim Flashner@* @@ -21926,6 +21926,78 @@ The @code{(gnu services nfs)} module provides the following services, which are most commonly used in relation to mounting or exporting directory trees as @dfn{network file systems} (NFS). +While it is possible to use the individual components that together make +up a Network File System service, we recommended to configure an NFS +server with the @code{nfs-service-type}. + +@subsubheading NFS Service +@cindex NFS, server + +The NFS service takes care of setting up all NFS component services, +kernel configuration file systems, and installs configuration files in +the locations that NFS expects. + +@defvr {Scheme Variable} nfs-service-type +A service type for a complete NFS server. +@end defvr + +@deftp {Data Type} nfs-configuration +This data type represents the configuration of the NFS service and all +of its subsystems. + +It has the following parameters: +@table @asis +@item @code{nfs-utils} (default: @code{nfs-utils}) +The nfs-utils package to use. + +@item @code{nfs-version} (default: @code{#f}) +If a string value is provided, the @command{rpc.nfsd} daemon will be +limited to supporting the given version of the NFS protocol. + +@item @code{exports} (default: @code{'()}) +This is a list of directories the NFS server should export. Each entry +is a list consisting of two elements: a directory name and a string +containing all options. This is an example in which the directory +@file{/export} is served to all NFS clients as a read-only share: + +@lisp +(nfs-configuration + (exports + '(("/export" + "*(ro,insecure,no_subtree_check,crossmnt,fsid=0)")))) +@end lisp + +@item @code{rpcmountd-port} (default: @code{#f}) +The network port that the @command{rpc.mountd} daemon should use. + +@item @code{rpcstatd-port} (default: @code{#f}) +The network port that the @command{rpc.statd} daemon should use. + +@item @code{rpcbind} (default: @code{rpcbind}) +The rpcbind package to use. + +@item @code{idmap-domain} (default: @code{"localdomain"}) +The local NFSv4 domain name. + +@item @code{nfsd-port} (default: @code{2049}) +The network port that the @command{nfsd} daemon should use. + +@item @code{nfsd-threads} (default: @code{8}) +The number of threads used by the @command{nfsd} daemon. + +@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"}) +The directory where the pipefs file system is mounted. + +@item @code{debug} (default: @code{'()"}) +A list of subsystems for which debugging output should be enabled. This +is a list of symbols. Any of these symbols are valid: @code{nfsd}, +@code{nfs}, @code{rpc}, @code{idmap}, @code{statd}, or @code{mountd}. +@end table +@end deftp + +If you don't need a complete NFS service or prefer to build it yourself +you can use the individual component services that are documented below. + @subsubheading RPC Bind Service @cindex rpcbind diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm index cd7e8fab01..ddc9e2c47e 100644 --- a/gnu/services/nfs.scm +++ b/gnu/services/nfs.scm @@ -22,6 +22,7 @@ #:use-module (gnu services shepherd) #:use-module (gnu packages onc-rpc) #:use-module (gnu packages linux) + #:use-module (gnu packages nfs) #:use-module (guix) #:use-module (guix records) #:use-module (srfi srfi-1) @@ -41,7 +42,11 @@ gss-service-type gss-configuration - gss-configuration?)) + gss-configuration? + + nfs-service-type + nfs-configuration + nfs-configuration?)) (define default-pipefs-directory "/var/lib/nfs/rpc_pipefs") @@ -234,3 +239,177 @@ (compose identity) (extend (lambda (config values) (first values))) (default-value (idmap-configuration))))) + +(define-record-type* + nfs-configuration make-nfs-configuration + nfs-configuration? + (nfs-utils nfs-configuration-nfs-utils + (default nfs-utils)) + (nfs-version nfs-configuration-nfs-version + (default #f)) ; string + (exports nfs-configuration-exports + (default '())) + (rpcmountd-port nfs-configuration-rpcmountd-port + (default #f)) + (rpcstatd-port nfs-configuration-rpcstatd-port + (default #f)) + (rpcbind nfs-configuration-rpcbind + (default rpcbind)) + (idmap-domain nfs-configuration-idmap-domain + (default "localdomain")) + (nfsd-port nfs-configuration-nfsd-port + (default 2049)) + (nfsd-threads nfs-configuration-nfsd-threads + (default 8)) + (pipefs-directory nfs-configuration-pipefs-directory + (default default-pipefs-directory)) + ;; List of modules to debug; any of nfsd, nfs, rpc, idmap, statd, or mountd. + (debug nfs-configuration-debug + (default '()))) + +(define (nfs-shepherd-services config) + "Return a list of for the NFS daemons with CONFIG." + (match-record config + (nfs-utils nfs-version exports + rpcmountd-port rpcstatd-port nfsd-port nfsd-threads + pipefs-directory debug) + (list (shepherd-service + (documentation "Run the NFS statd daemon.") + (provision '(rpc.statd)) + (requirement '(rpcbind-daemon)) + (start + #~(make-forkexec-constructor + (list #$(file-append nfs-utils "/sbin/rpc.statd") + ;; TODO: notification support may require a little more + ;; configuration work. + "--no-notify" + #$@(if (member 'statd debug) + '("--no-syslog") ; verbose logging to stderr + '()) + "--foreground" + #$@(if rpcstatd-port + '("--port" (number->string rpcstatd-port)) + '())) + #:pid-file "/var/run/rpc.statd.pid")) + (stop #~(make-kill-destructor))) + (shepherd-service + (documentation "Run the NFS mountd daemon.") + (provision '(rpc.mountd)) + (requirement '(rpc.statd)) + (start + #~(make-forkexec-constructor + (list #$(file-append nfs-utils "/sbin/rpc.mountd") + #$@(if (member 'mountd debug) + '("--debug" "all") + '()) + #$@(if rpcmountd-port + '("--port" (number->string rpcmountd-port)) + '())))) + (stop #~(make-kill-destructor))) + (shepherd-service + (documentation "Run the NFS daemon.") + (provision '(rpc.nfsd)) + (requirement '(rpc.statd networking)) + (start + #~(lambda _ + (zero? (system* #$(file-append nfs-utils "/sbin/rpc.nfsd") + #$@(if (member 'nfsd debug) + '("--debug") + '()) + "--port" #$(number->string nfsd-port) + #$@(if nfs-version + '("--nfs-version" nfs-version) + '()) + #$(number->string nfsd-threads))))) + (stop + #~(lambda _ + (zero? + (system* #$(file-append nfs-utils "/sbin/rpc.nfsd") "0"))))) + (shepherd-service + (documentation "Run the NFS mountd daemon and refresh exports.") + (provision '(nfs)) + (requirement '(rpc.nfsd rpc.mountd rpc.statd rpcbind-daemon)) + (start + #~(lambda _ + (let ((rpcdebug #$(file-append nfs-utils "/sbin/rpcdebug"))) + (cond + ((member 'nfsd '#$debug) + (system* rpcdebug "-m" "nfsd" "-s" "all")) + ((member 'nfs '#$debug) + (system* rpcdebug "-m" "nfs" "-s" "all")) + ((member 'rpc '#$debug) + (system* rpcdebug "-m" "rpc" "-s" "all")))) + (zero? (system* + #$(file-append nfs-utils "/sbin/exportfs") + "-r" ; re-export + "-a" ; everthing + "-v" ; be verbose + "-d" "all" ; debug + )))) + (stop + #~(lambda _ + (let ((rpcdebug #$(file-append nfs-utils "/sbin/rpcdebug"))) + (cond + ((member 'nfsd '#$debug) + (system* rpcdebug "-m" "nfsd" "-c" "all")) + ((member 'nfs '#$debug) + (system* rpcdebug "-m" "nfs" "-c" "all")) + ((member 'rpc '#$debug) + (system* rpcdebug "-m" "rpc" "-c" "all")))) + #t)) + (respawn? #f))))) + +(define nfs-service-type + (service-type + (name 'nfs) + (extensions + (list + (service-extension shepherd-root-service-type nfs-shepherd-services) + (service-extension activation-service-type + (const #~(begin + (use-modules (guix build utils)) + (system* "mount" "-t" "nfsd" + "nfsd" "/proc/fs/nfsd") + + (mkdir-p "/var/lib/nfs") + ;; directory containing monitor list + (mkdir-p "/var/lib/nfs/sm") + ;; Needed for client recovery tracking + (mkdir-p "/var/lib/nfs/v4recovery") + (let ((user (getpw "nobody"))) + (chown "/var/lib/nfs" + (passwd:uid user) + (passwd:gid user)) + (chown "/var/lib/nfs/v4recovery" + (passwd:uid user) + (passwd:gid user))) + #t))) + (service-extension etc-service-type + (lambda (config) + `(("exports" + ,(plain-file "exports" + (string-join + (map string-join + (nfs-configuration-exports config)) + "\n")))))) + ;; The NFS service depends on these other services. They are extended so + ;; that users don't need to configure them manually. + (service-extension idmap-service-type + (lambda (config) + (idmap-configuration + (domain (nfs-configuration-idmap-domain config)) + (verbosity + (if (member 'idmap (nfs-configuration-debug config)) + 10 0)) + (pipefs-directory (nfs-configuration-pipefs-directory config)) + (nfs-utils (nfs-configuration-nfs-utils config))))) + (service-extension pipefs-service-type + (lambda (config) + (pipefs-configuration + (mount-point (nfs-configuration-pipefs-directory config))))) + (service-extension rpcbind-service-type + (lambda (config) + (rpcbind-configuration + (rpcbind (nfs-configuration-rpcbind config))))))) + (description + "Run all NFS daemons and refresh the list of exported file systems."))) diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm index 7ef9f1f7bf..014d049ab5 100644 --- a/gnu/tests/nfs.scm +++ b/gnu/tests/nfs.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2018 Clément Lassieur +;;; Copyright © 2019, 2020 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,10 +34,12 @@ #:use-module (gnu services nfs) #:use-module (gnu services networking) #:use-module (gnu packages onc-rpc) + #:use-module (gnu packages nfs) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix monads) - #:export (%test-nfs)) + #:export (%test-nfs + %test-nfs-server)) (define %base-os (operating-system @@ -53,8 +56,7 @@ rpcbind %base-packages)) (services (cons* - (service rpcbind-service-type - (rpcbind-configuration)) + (service rpcbind-service-type) (service dhcp-client-service-type) %base-services)))) @@ -133,3 +135,152 @@ (name "nfs") (description "Test some things related to NFS.") (value (run-nfs-test name "/var/run/rpcbind.sock")))) + + +(define %nfs-os + (let ((os (simple-operating-system + (simple-service 'create-target-directory activation-service-type + #~(begin + (mkdir "/remote") + (chmod "/remote" #o777) + #t)) + (service dhcp-client-service-type) + (service nfs-service-type + (nfs-configuration + (debug '(nfs nfsd mountd)) + (exports '(("/export" + ;; crossmnt = This is the pseudo root. + ;; fsid=0 = root file system of the export + "*(ro,insecure,no_subtree_check,crossmnt,fsid=0)")))))))) + (operating-system + (inherit os) + (host-name "nfs-server") + ;; We need to use a tmpfs here, because the test system's root file + ;; system cannot be re-exported via NFS. + (file-systems (cons + (file-system + (device "none") + (mount-point "/export") + (type "tmpfs") + (create-mount-point? #t)) + %base-file-systems)) + (services + ;; Enable debugging output. + (modify-services (operating-system-user-services os) + (syslog-service-type config + => + (syslog-configuration + (inherit config) + (config-file + (plain-file + "syslog.conf" + "*.* /dev/console\n"))))))))) + +(define (run-nfs-server-test) + "Run a test of an OS running a service of NFS-SERVICE-TYPE." + (define os + (marionette-operating-system + %nfs-os + #:requirements '(nscd) + #:imported-modules '((gnu services herd) + (guix combinators)))) + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (srfi srfi-64)) + + (define marionette + (make-marionette (list #$(virtual-machine os)))) + (define (wait-for-file file) + ;; Wait until FILE exists in the guest + (marionette-eval + `(let loop ((i 10)) + (cond ((file-exists? ,file) + #t) + ((> i 0) + (sleep 1) + (loop (- i 1))) + (else + (error "File didn't show up: " ,file)))) + marionette)) + + (mkdir #$output) + (chdir #$output) + + (test-begin "nfs-daemon") + (marionette-eval + '(begin + (current-output-port + (open-file "/dev/console" "w0")) + (chmod "/export" #o777) + (with-output-to-file "/export/hello" + (lambda () (display "hello world"))) + (chmod "/export/hello" #o777)) + marionette) + + (test-assert "nscd PID file is created" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'nscd)) + marionette)) + + (test-assert "nscd is listening on its socket" + (marionette-eval + ;; XXX: Work around a race condition in nscd: nscd creates its + ;; PID file before it is listening on its socket. + '(let ((sock (socket PF_UNIX SOCK_STREAM 0))) + (let try () + (catch 'system-error + (lambda () + (connect sock AF_UNIX "/var/run/nscd/socket") + (close-port sock) + (format #t "nscd is ready~%") + #t) + (lambda args + (format #t "waiting for nscd...~%") + (usleep 500000) + (try))))) + marionette)) + + (test-assert "network is up" + (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'networking)) + marionette)) + + ;; Wait for the NFS services to be up and running. + (test-assert "nfs services are running" + (and (marionette-eval + '(begin + (use-modules (gnu services herd)) + (start-service 'nfs)) + marionette) + (wait-for-file "/var/run/rpc.statd.pid"))) + + (test-assert "nfs share is advertised" + (marionette-eval + '(zero? (system* (string-append #$nfs-utils "/sbin/showmount") + "-e" "nfs-server")) + marionette)) + + (test-assert "nfs share mounted" + (marionette-eval + '(begin + (and (zero? (system* (string-append #$nfs-utils "/sbin/mount.nfs4") + "nfs-server:/" "/remote" "-v")) + (file-exists? "/remote/hello"))) + marionette)) + (test-end) + (exit (= (test-runner-fail-count (test-runner-current)) 0))))) + + (gexp->derivation "nfs-server-test" test)) + +(define %test-nfs-server + (system-test + (name "nfs-server") + (description "Test that an NFS server can be started and exported +directories can be mounted.") + (value (run-nfs-server-test))))