Subject: bug#26548: [PATCH] install: Enable SSH in installation image.

From: [email-masked] (Ludovic Courtès)
Date: Wed, 10 May 2017 22:28:17 +0200

Marius Bakke <[email-masked]> skribis:

> Ludovic Courtès <[email-masked]> writes:

[...]

>> This is a problem: in the installation instructions, we tell people to
>> configure networking (possibly wireless) by hand, so we cannot expect
>> the DHCP client to work directly when the image is booted.
>>
>> Also, the installation instructions would need to be updated.
>>
>> However, what we could do, instead, is to add an SSH service that is off
>> by default (with (start? #f)) and does not depend on ‘networking’.  That
>> way, people would only need to type
>>
>>   herd start ssh-daemon
>>
>> to get the thing up and running.  WDYT?
>
> I've changed this patch to use OpenSSH, but can't really see how to
> override the openssh-shepherd-service to not depend on networking. Any
> hints? :-)

Does it make sense in the first place to have it depend on ‘networking’?
Isn’t sshd able to adjust as new interfaces come up and down?

That said, you could do (untested):

  (define custom-openssh-service-type
    (service-type
      (inherit openssh-service-type)
      (extensions (cons my-own-shepherd-service-extension
                        (remove shepherd-service-extension?
                                (service-type-extensions openssh-service-type))))))

where:

  (define (shepherd-service-extension? extension)
    (eq? shepherd-root-service-type
         (service-extension-target extension)))

  (define my-own-shepherd-service-extension
    (service-extension shepherd-root-service-type
                       my-own-proc))

  …

Does that make sense?

Ludo’.