[PATCH] gnu: Add autofs.

  • Done
  • quality assurance status badge
Details
3 participants
  • Oleg Pykhalov
  • Ludovic Courtès
  • Tobias Geerinckx-Rice
Owner
unassigned
Submitted by
Oleg Pykhalov
Severity
normal
Merged with
O
O
Oleg Pykhalov wrote on 24 Jun 2020 17:56
(address . guix-patches@gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20200624155605.23002-1-go.wigust@gmail.com
* gnu/packages/file-systems.scm (autofs): New variable.
---
gnu/packages/file-systems.scm | 77 +++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)

Toggle diff (101 lines)
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index dd72152c51..c8d881e542 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -36,6 +36,7 @@
#:use-module (gnu packages acl)
#:use-module (gnu packages attr)
#:use-module (gnu packages autotools)
+ #:use-module (gnu packages base)
#:use-module (gnu packages bison)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
@@ -57,6 +58,7 @@
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
#:use-module (gnu packages rsync)
+ #:use-module (gnu packages sssd)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages tls)
#:use-module (gnu packages valgrind)
@@ -782,3 +784,78 @@ directory onto a single drive and create FreeDesktop.org Trash specification
compatible directories.")
(home-page "https://github.com/trapexit/mergerfs-tools")
(license license:isc))))
+
+(define-public autofs
+ (package
+ (name "autofs")
+ (version "5.1.6")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://mirrors.edge.kernel.org/pub/linux/daemons/autofs/v"
+ (version-major version) "/autofs-" version ".tar.xz"))
+ (sha256
+ (base32
+ "1vya21mb4izj3khcr3flibv7xc15vvx2v0rjfk5yd31qnzcy7pnx"))))
+ (build-system gnu-build-system)
+ (inputs `(("util-linux" ,util-linux)
+ ("nfs-utils" ,nfs-utils)
+ ("kmod" ,kmod)
+ ("e2fsprogs" ,e2fsprogs)
+ ("sssd" ,sssd)
+ ("linux-headers" ,linux-libre-headers)
+ ("libtirpc", libtirpc)
+ ("binutils" ,binutils)
+ ("rpcsvc-proto" ,rpcsvc-proto) ;for 'rpcgen'
+ ("libxml2" ,libxml2)))
+ (native-inputs
+ `(("flex" ,flex)
+ ("bison" ,bison)
+ ("pkg-config" ,pkg-config)))
+ (arguments
+ `(#:tests? #f ; no tests
+ #:validate-runpath? #f
+ #:configure-flags '("--enable-force-shutdown" "--with-path=$PATH"
+ "--enable-ignore-busy")
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'pre-configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (setenv "exportsssldir" (string-append (assoc-ref inputs "sssd")
+ "/lib/sssd/modules"))
+ (setenv "HAVE_SSS_AUTOFS" "1")
+ (setenv "YACC" (string-append (assoc-ref inputs "bison")
+ "/bin/yacc"))
+ (setenv "RANLIB" (string-append (assoc-ref inputs "binutils")
+ "/bin/ranlib"))
+ (setenv "RPCGEN" (string-append (assoc-ref inputs "rpcsvc-proto")
+ "/bin/rpcgen"))
+ (setenv "LEX" (string-append (assoc-ref inputs "flex")
+ "/bin/flex"))
+ (setenv "MOUNT" (string-append (assoc-ref inputs "util-linux")
+ "/bin/mount"))
+ (setenv "MOUNT_NFS" (string-append (assoc-ref inputs "nfs-utils")
+ "/sbin/mount.nfs"))
+ (setenv "UMOUNT" (string-append (assoc-ref inputs "util-linux")
+ "/bin/umount"))
+ (setenv "MODPROBE" (string-append (assoc-ref inputs "kmod")
+ "/bin/modprobe"))
+ (setenv "E2FSCK" (string-append (assoc-ref inputs "e2fsprogs")
+ "/sbin/fsck.ext2"))
+ (setenv "E3FSCK" (string-append (assoc-ref inputs "e2fsprogs")
+ "/sbin/fsck.ext3"))
+ (setenv "E4FSCK" (string-append (assoc-ref inputs "e2fsprogs")
+ "/sbin/fsck.ext4"))
+ ;; Allow <rpc/rpc.h> & co. to be found.
+ (setenv "CPATH" (string-append (assoc-ref inputs "libtirpc")
+ "/include/tirpc"))
+ ;; Makefile.rules defines a usable STRIP only without the env var.
+ (unsetenv "STRIP")
+ #t)))))
+ (home-page "https://www.kernel.org/pub/linux/daemons/autofs/")
+ (synopsis "Kernel-based automounter")
+ (description "Autofs controls the operation of the automount daemons. The
+automount daemons automatically mount filesystems when they are used and
+unmount them after a period of inactivity. This is done based on a set of
+pre-configured maps.")
+ (license license:gpl2)))
--
2.26.2
L
L
Ludovic Courtès wrote on 25 Jun 2020 12:12
control message for bug #42031
(address . control@debbugs.gnu.org)
87zh8rsbct.fsf@gnu.org
merge 42031 42033
quit
L
L
Ludovic Courtès wrote on 25 Jun 2020 12:12
Re: [bug#42031] [PATCH] gnu: Add autofs.
(address . 42031@debbugs.gnu.org)
87v9jfsbbr.fsf@gnu.org
Hey comrades!

Since you both submitted a patch adding autofs, I suggest that you
review each other’s patch. :-)

Ludo’.
T
T
Tobias Geerinckx-Rice wrote on 25 Jun 2020 14:27
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 42031@debbugs.gnu.org)
875zbg41nu.fsf@nckx
Oleg,

Thank you for the patch!

I'm superbly biased[1] but 3 cruel people have insisted we review
each others' patches so here you go :-)

Oleg told me on #guix that this is basically a straight port from
Nix[0]. The Nix package is very… not good? There's nothing worth
scavenging. A ‘reviewed’ version of Oleg's patch ends up
identical to mine, but without the SASL support.

Oleg Pykhalov ???
Toggle quote (60 lines)
> * gnu/packages/file-systems.scm (autofs): New variable.
> ---
> gnu/packages/file-systems.scm | 77
> +++++++++++++++++++++++++++++++++++
> 1 file changed, 77 insertions(+)
>
> diff --git a/gnu/packages/file-systems.scm
> b/gnu/packages/file-systems.scm
> index dd72152c51..c8d881e542 100644
> --- a/gnu/packages/file-systems.scm
> +++ b/gnu/packages/file-systems.scm
> @@ -36,6 +36,7 @@
> #:use-module (gnu packages acl)
> #:use-module (gnu packages attr)
> #:use-module (gnu packages autotools)
> + #:use-module (gnu packages base)
> #:use-module (gnu packages bison)
> #:use-module (gnu packages check)
> #:use-module (gnu packages compression)
> @@ -57,6 +58,7 @@
> #:use-module (gnu packages python-xyz)
> #:use-module (gnu packages readline)
> #:use-module (gnu packages rsync)
> + #:use-module (gnu packages sssd)
> #:use-module (gnu packages sqlite)
> #:use-module (gnu packages tls)
> #:use-module (gnu packages valgrind)
> @@ -782,3 +784,78 @@ directory onto a single drive and create
> FreeDesktop.org Trash specification
> compatible directories.")
> (home-page "https://github.com/trapexit/mergerfs-tools")
> (license license:isc))))
> +
> +(define-public autofs
> + (package
> + (name "autofs")
> + (version "5.1.6")
> + (source (origin
> + (method url-fetch)
> + (uri (string-append
> +
> "https://mirrors.edge.kernel.org/pub/linux/daemons/autofs/v"
> + (version-major version) "/autofs-" version
> ".tar.xz"))
> + (sha256
> + (base32
> +
> "1vya21mb4izj3khcr3flibv7xc15vvx2v0rjfk5yd31qnzcy7pnx"))))
> + (build-system gnu-build-system)
> + (inputs `(("util-linux" ,util-linux)
> + ("nfs-utils" ,nfs-utils)
> + ("kmod" ,kmod)
> + ("e2fsprogs" ,e2fsprogs)
> + ("sssd" ,sssd)
> + ("linux-headers" ,linux-libre-headers)
> + ("libtirpc", libtirpc)
> + ("binutils" ,binutils)
> + ("rpcsvc-proto" ,rpcsvc-proto) ;for 'rpcgen'
> + ("libxml2" ,libxml2)))

Order *inputs alphabetically.

rpcsvc-proto should be native. So would binutils, but including
it at all is probably a mistake.

linux-libre-headers aren't necessary. Nor is kmod.

Sometimes, configure scripts check for things just for fun.

Toggle quote (7 lines)
> + (native-inputs
> + `(("flex" ,flex)
> + ("bison" ,bison)
> + ("pkg-config" ,pkg-config)))
> + (arguments
> + `(#:tests? #f ; no tests

Despite the ‘warning: foo not found, disabling the foo tests’
./configure warnings I didn't find them either.

Toggle quote (2 lines)
> + #:validate-runpath? #f

This is a sign that something is broken & needs to be fixed, not
ignored.

Toggle quote (2 lines)
> + #:configure-flags '("--enable-force-shutdown"

INSTALL describes this as:

--enable-force-shutdown
This option enables the use of the USR1 signal to force an
unconditional unlink umount of all mounts at shutdown.

Safety aside, I read that as ‘requires init/service to actually
send the signal on shutdown to have any effect’. There's no
autofs service that does so yet.

I don't have much of an opinion about it. Does anyone think it's
useful or unsafe?

Toggle quote (2 lines)
> "--with-path=$PATH"

In Nix, everything between ''fun quotes'' is evaluated by a shell.
In Guix, unless ./configure does its own eval somewhere (I didn't
check), this just sets the path to (literally) "$PATH".

Toggle quote (11 lines)
> + "--enable-ignore-busy")
> + #:phases
> + (modify-phases %standard-phases
> + (add-before 'configure 'pre-configure
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (setenv "exportsssldir" (string-append (assoc-ref
> inputs "sssd")
> +
> "/lib/sssd/modules"))
> + (setenv "HAVE_SSS_AUTOFS" "1")

Pass these as #:configure-flags when possible — it's declarative®.

Toggle quote (39 lines)
> + (setenv "YACC" (string-append (assoc-ref inputs
> "bison")
> + "/bin/yacc"))
> + (setenv "RANLIB" (string-append (assoc-ref inputs
> "binutils")
> + "/bin/ranlib"))
> + (setenv "RPCGEN" (string-append (assoc-ref inputs
> "rpcsvc-proto")
> + "/bin/rpcgen"))
> + (setenv "LEX" (string-append (assoc-ref inputs
> "flex")
> + "/bin/flex"))
> + (setenv "MOUNT" (string-append (assoc-ref inputs
> "util-linux")
> + "/bin/mount"))
> + (setenv "MOUNT_NFS" (string-append (assoc-ref
> inputs "nfs-utils")
> +
> "/sbin/mount.nfs"))
> + (setenv "UMOUNT" (string-append (assoc-ref inputs
> "util-linux")
> + "/bin/umount"))
> + (setenv "MODPROBE" (string-append (assoc-ref
> inputs "kmod")
> +
> "/bin/modprobe"))
> + (setenv "E2FSCK" (string-append (assoc-ref inputs
> "e2fsprogs")
> +
> "/sbin/fsck.ext2"))
> + (setenv "E3FSCK" (string-append (assoc-ref inputs
> "e2fsprogs")
> +
> "/sbin/fsck.ext3"))
> + (setenv "E4FSCK" (string-append (assoc-ref inputs
> "e2fsprogs")
> +
> "/sbin/fsck.ext4"))

All of this can be avoided with:

+ (add-before 'configure 'fix-hard-coded-search-path
+ (lambda _
+ (substitute* "configure"
+ (("^searchpath=\".*\"")
+ "searchpath=\"$PATH\""))
+ #t))

allowing the configure script to do the work of finding things.

Toggle quote (9 lines)
> + ;; Allow <rpc/rpc.h> & co. to be found.
> + (setenv "CPATH" (string-append (assoc-ref inputs
> "libtirpc")
> + "/include/tirpc"))
> + ;; Makefile.rules defines a usable STRIP only
> without the env var.
> + (unsetenv "STRIP")
> + #t)))))

Here too: I don't know if you simply copied these from Nix[0]
because they were there, or if you encountered errors without
them, but neither should be needed. I suspect STRIP is only
needed because of the bogus binutils input above, if at all.

Toggle quote (4 lines)
> + (home-page
> "https://www.kernel.org/pub/linux/daemons/autofs/")
> + (synopsis "Kernel-based automounter")

Which kernel? ;-)

Toggle quote (8 lines)
> + (description "Autofs controls the operation of the
> automount daemons. The
> +automount daemons automatically mount filesystems when they are
> used and
> +unmount them after a period of inactivity. This is done based
> on a set of
> +pre-configured maps.")

The first sentence describes the autofs *command*.

Toggle quote (2 lines)
> + (license license:gpl2)))

-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXvSYMwAKCRANsP+IT1Vt
ecBmAP0fMlTaLJQZ2jLsQN3K343EpBEWBwlbjZQu8rUhrkDGXQD9GQYYRgq2YTrN
LldJ72sN5fmiBhixlH4Pp/LLmVe9iAg=
=uvqd
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 25 Jun 2020 14:28
(no subject)
(address . control@debbugs.gnu.org)
87eeq3ba8c.fsf@nckx
merge 42031 42033
O
O
Oleg Pykhalov wrote on 25 Jun 2020 21:59
Re: [bug#42031] [PATCH] gnu: Add autofs.
(name . Tobias Geerinckx-Rice)(address . me@tobias.gr)(address . 42031@debbugs.gnu.org)
87h7uyq5lz.fsf@gmail.com
Hi,

Your patch looks good for me except minor:
Toggle diff (12 lines)
diff --git a/gnu/packages/file-systems.scm b/gnu/packages/file-systems.scm
index 7c3a19305f..0d62e64bf0 100644
--- a/gnu/packages/file-systems.scm
+++ b/gnu/packages/file-systems.scm
@@ -59,6 +59,7 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages readline)
+ #:use-module (gnu packages sssd)
#:use-module (gnu packages rsync)
#:use-module (gnu packages sqlite)
#:use-module (gnu packages tls)
I've tested your autofs recipe with my ext4 flash drive and sshfs. Both
works great. I think you could go a head with merging your cleaner
recipe.

Oleg.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAl71AhgACgkQFn+OpQAa
+pxTRQ//aVBs/HJeepXwWzMj800GumTWZX8AcXHLEmHX6YTuP+yBlo7vOnOWMK58
AChGRENOAPoiVbjWAoh0zRrdXwfcS0a2KKAnWESehSVHgq67iGKE4qGqqIHE62yJ
Q/eVtG8zhmyLsBybJkakyz+7urWEH69Pc2t4QISlqJN9V2F38VhLwF4W34i3hmu0
WqdideRrgo36LuZhMCcMDI5B3OuXbFVdUfLhi08GRzfCL/44qNekDQl02NQUjqDZ
i9hawJr+l4c29dWnZhJYfpCYZ2QvvRWXwqOo+sunb2s8GJboVMKXMsQD1+yrSev0
Tv32/XJplR2CF9YDARgKnuXHYIxm/avyVIQzYx7SKPRTGpyIXe6LYwp1XutL8Y65
tv0zdZfAnOAHSl/7VRcjLwR9QDrDc+zVhlGzGyHFCmyYflfnZRRTWMP7oT7AXhES
u9lzoT/zJcBAB1nWUcMjm1SKYChcmqxvG07NMt8syPeUqxxhSres8CW/SouF5Nf1
prfKd1LLXaRPM2YOTgue3BhlFHiv5twLtuj/ExzjYhoUdwt5iNwEyFF/bPg9Lbj5
kTRaS6S0f0zfzIE1slB1h/PpSsfcAnLAqIzdrGN99adsdWRgI/gXIjtpFSODqjmG
H600JVWQSK4ehFvJI5TgoIBxc+eTyonXUb334BoypHXFh9PkPJw=
=zJ/A
-----END PGP SIGNATURE-----

T
T
Tobias Geerinckx-Rice wrote on 28 Jun 2020 11:40
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 42031-done@debbugs.gnu.org)
87tuyvr0j1.fsf@nckx
Oleg,

Oleg Pykhalov ???
Toggle quote (4 lines)
> Hi,
>
> Your patch looks good for me except minor:

Thanks! Lost in the git dance.

Toggle quote (6 lines)
> I've tested your autofs recipe with my ext4 flash drive and
> sshfs. Both
> works great. I think you could go a head with merging your
> cleaner
> recipe.

Pushed as 5c10200b5499826a2e430a46fdb664d269857278!

Kind regards,

T G-R
-----BEGIN PGP SIGNATURE-----

iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXvhlkgAKCRANsP+IT1Vt
eR7pAQDCpLAF+ZAP1VrUVBcelVymBxekHDosT2IGP2Ma462dvAD/fgz/c8oge0tB
8mVmpNbKpyb3KT/nRJV3ubx1X/gVbg8=
=O+vI
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 42031@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 42031
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch