guix-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] services: lsh: Add "graceful" handling of daemonic option.


From: Ludovic Courtès
Subject: Re: [PATCH] services: lsh: Add "graceful" handling of daemonic option.
Date: Sat, 06 Dec 2014 15:28:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Deck Pickard <address@hidden> skribis:

> From 1fef935d6292016c04b9234eedb5dcaf006dc152 Mon Sep 17 00:00:00 2001
> From: nebuli <address@hidden>
> Date: Wed, 3 Dec 2014 22:51:48 +0100
> Subject: [PATCH] services: lsh: Add graceful handling of daemonic option.
>
> * doc/guix.texi: Mention use case.
> * gnu/services/ssh.scm (lsh-service): New #:keys (daemonic?, pid-file?,
>   pid-file).  Build new lshd-command and expand service-requirement
>   field.

Nice!

>  (define* (lsh-service #:key
>                        (lsh lsh)
> +                      (daemonic? #f)
>                        (host-key "/etc/lsh/host-key")
>                        (interfaces '())
>                        (port-number 22)
>                        (allow-empty-passwords? #f)
>                        (root-login? #f)
>                        (syslog-output? #t)
> +                      (pid-file? #f)
> +                      (pid-file "/var/run/lshd.pid")
>                        (x11-forwarding? #t)
>                        (tcp/ip-forwarding? #t)
>                        (password-authentication? #t)

I would be tempted to not expose #:daemonic?, #:pid-file? and
#:syslog-output?, and instead always use --daemonic --pid-file=...

In particular, when using --daemonic, having the PID file is required,
otherwise dmd won’t know what the PID of this process is, and thus will
be unable to control it.  For that reason, #:pid-file? must not be
exposed.

WDYT?

> +  (define requires
> +    (if (and daemonic? syslog-output?)
> +        '(networking syslogd)
> +        '(networking)))

If we agree on the above, that would become '(networking syslogd)
unconditionally.

>      (return (service
>               (documentation "GNU lsh SSH server")
>               (provision '(ssh-daemon))
> -             (requirement '(networking))
> +             (requirement #~(address@hidden))

This is strictly equivalent to:

  (requirement `(,@requires))

or simply:

  (requirement requires)

:-)

G-expressions are only needed when capturing references to /gnu/store
items, packages, etc.

Thanks,
Ludo’.



reply via email to

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