[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#68675] [PATCH v2] services: dhcp: Support the dhcpcd implementation
From: |
Ludovic Courtès |
Subject: |
[bug#68675] [PATCH v2] services: dhcp: Support the dhcpcd implementation. |
Date: |
Wed, 28 Feb 2024 21:46:16 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi Sören,
Apologies for the late reply.
Sören Tempel <soeren@soeren-tempel.net> skribis:
> Ludovic Courtès <ludo@gnu.org> wrote:
>> Instead of calling ‘package-name’, which would prevent the use of
>> something other than a <package> record (such as an <inferior-package>)
>> or a package with a different name (like “dhcpcd-next”), what about
>> checking in the gexp which of /bin/dhclient and /bin/dhcpcd exists?
>
> I think I haven't fully grasped G-Expressions yet. I do understand how
> this would work inside the shepherd start gexp. However, I am not sure
> how I would check if /bin/dhclient or /bin/dhcpcd exist in the package
> within the dhcp-client-account-service since, at least as far as
> I understand, the dhcp-client-account-service is itself not a gexp.
I meant, within the ‘start’ method, something like:
(start #~(…
;; Check whether we’re dealing with ISC’s dhclient or dhcpcd.
(let ((type (if (file-exists?
(string-append #$package "/bin/dhclient"))
'isc-dhcp
'dhcpcd)))
(fork+exec-command …))))
Does that make sense?
>> That sounds quite complex. Surely there must be a way to force the name
>> of the PID file or to determine its name without running dhcpcd in a
>> pipe?
>
> Unfortunately, I don't think there is any way to force the PID file
> name. Furthermore, the pidfile path depends on the amount interfaces
> specified. If there is only one interface, a single dhcpcd instance is
> spawned and the pidfile refers to that. Otherwise, a management process
> is started and the pidfile refers to the management process [1].
>
> I think the best solution here would be to spawn dhcpcd as child process
> of GNU shepherd and have shepherd supervise it that way. I have a service
> doing that too, but its annoying to integrate with the existing dhclient
> service [2]. Maybe that's something we can migrate to in the long run.
What do others do? I guess it’s not possible to have a systemd .service
file given those PID file semantics, is it?
Thanks,
Ludo’.