[PATCH] gnu: Add dhcpcd.

  • Done
  • quality assurance status badge
Details
2 participants
  • soeren
  • Zheng Junjie
Owner
unassigned
Submitted by
soeren
Severity
normal

Debbugs page

soeren wrote 2 months ago
(address . guix-patches@gnu.org)
b271e36e1f4e5ff7fa809e841e1f62c750dd2306.1736600114.git.soeren@soeren-tempel.net
From: Sören Tempel <soeren@soeren-tempel.net>

* gnu/packages/admin.scm (dhcpcd): new procedure.

Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>
---
This adds an alternative to isc-dhcpd which has reached its end-of-life
in 2022 (i.e. three years ago!) and hasn't been maintained and patched
upstream since [1]. This patch has been extracted from #68675 [2] in the
hopes that it will be easier to get the package merged first and then
propose either a standalone services [3] or a service integrated into
dhcp-client-service-type [4] separatly afterwards.


gnu/packages/admin.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)

Toggle diff (69 lines)
diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index 7fd05341993..2e9640a9e1e 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -1712,6 +1712,62 @@ (define-public isc-dhcp
(license license:mpl2.0)
(properties '((cpe-name . "dhcp"))))))
+(define-public dhcpcd
+ (package
+ (name "dhcpcd")
+ (version "10.0.6")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/NetworkConfiguration/dhcpcd")
+ (commit (string-append "v" version))))
+ (sha256
+ (base32 "07n7d5wsmy955i6l8rkcmxhgxjygj2cxgpw79id2hx9w41fbkl5l"))
+ (file-name (git-file-name name version))))
+ (inputs (list bash-minimal))
+ (native-inputs (list eudev))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:test-target "test"
+ #:configure-flags #~(list "--enable-ipv6"
+ "--enable-privsep"
+ "--privsepuser=dhcpcd"
+ (string-append "--dbdir=" "/var/db/dhcpcd")
+ (string-append "--rundir=" "/var/run/dhcpcd")
+ (string-append "CC=" #$(cc-for-target)))
+ #:phases #~(modify-phases %standard-phases
+ (add-after 'unpack 'do-not-create-dbdir
+ (lambda _
+ ;; Make sure that the Makefile doesn't attempt to create
+ ;; /var/db/dhcpcd for which it doesn't have permissions.
+ (substitute* "src/Makefile"
+ (("\\$\\{INSTALL\\} -m \\$\\{DBMODE\\} -d \\$\\{DESTDIR\\}\\$\\{DBDIR\\}")
+ ""))))
+ (add-before 'build 'setenv
+ (lambda _
+ (setenv "HOST_SH" (which "sh"))))
+ (add-after 'install 'wrap-hooks
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (libexec (string-append out "/libexec"))
+ (sed (search-input-file inputs "/bin/sed"))
+ (rm (search-input-file inputs "/bin/rm")))
+ (wrap-program (string-append libexec
+ "/dhcpcd-run-hooks")
+ `("PATH" ":" suffix
+ (,(dirname sed)
+ ,(dirname rm))))))))))
+ (home-page "https://roy.marples.name/projects/dhcpcd")
+ (synopsis "Feature-rich DHCP and DHCPv6 client")
+ (description
+ "Provides a DHCP and a DHCPv6 client. Additionally,
+dhcpcd is also an IPv4LL (aka ZeroConf) client. In layperson's terms,
+dhcpcd runs on your machine and silently configures your computer to work
+on the attached networks without trouble and mostly without configuration.")
+ (license license:bsd-2)))
+
(define-public radvd
(package
(name "radvd")

base-commit: bd24a13c572f1c4cf0e104adc7ca81fe71fee632
Zheng Junjie wrote 1 months ago
(address . soeren@soeren-tempel.net)
87tt9kzzeu.fsf@iscas.ac.cn
soeren@soeren-tempel.net writes:

Toggle quote (6 lines)
> From: Sören Tempel <soeren@soeren-tempel.net>
>
> * gnu/packages/admin.scm (dhcpcd): new procedure.
>
> Signed-off-by: Sören Tempel <soeren@soeren-tempel.net>

| When pushing a commit on behalf of somebody else, please add a
|‘Signed-off-by’ line at the end of the commit log message—e.g., with
|‘git am --signoff’. This improves tracking of who did what.

So you don't need to add this line

Toggle quote (37 lines)
> ---
> This adds an alternative to isc-dhcpd which has reached its end-of-life
> in 2022 (i.e. three years ago!) and hasn't been maintained and patched
> upstream since [1]. This patch has been extracted from #68675 [2] in the
> hopes that it will be easier to get the package merged first and then
> propose either a standalone services [3] or a service integrated into
> dhcp-client-service-type [4] separatly afterwards.
>
> [1]: https://issues.guix.gnu.org/68619
> [2]: https://issues.guix.gnu.org/68675
> [3]: https://github.com/nmeum/guix-channel/blob/b1b80697a9d35ca015ce56ccf3031f91f2bf554f/src/nmeum/services/networking.scm#L130-L132
> [4]: https://issues.guix.gnu.org/68675#10
>
> gnu/packages/admin.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 56 insertions(+)
>
> diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
> index 7fd05341993..2e9640a9e1e 100644
> --- a/gnu/packages/admin.scm
> +++ b/gnu/packages/admin.scm
> @@ -1712,6 +1712,62 @@ (define-public isc-dhcp
> (license license:mpl2.0)
> (properties '((cpe-name . "dhcp"))))))
>
> +(define-public dhcpcd
> + (package
> + (name "dhcpcd")
> + (version "10.0.6")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/NetworkConfiguration/dhcpcd")
> + (commit (string-append "v" version))))
> + (sha256
> + (base32 "07n7d5wsmy955i6l8rkcmxhgxjygj2cxgpw79id2hx9w41fbkl5l"))
> + (file-name (git-file-name name version))))
adjust to

(origin
(uri ...)
(file-name ...)
(sha256 ...))

It's a general habit

Toggle quote (2 lines)
> + (inputs (list bash-minimal))

please test the cross-compilation next time.

I add coreutils-minimal for rm, add sed for sed, and move eudev from
native-inputs to inputs, because this is a compile-time library
dependency.


Toggle quote (19 lines)
> + (native-inputs (list eudev))
> + (build-system gnu-build-system)
> + (arguments
> + (list
> + #:test-target "test"
> + #:configure-flags #~(list "--enable-ipv6"
> + "--enable-privsep"
> + "--privsepuser=dhcpcd"
> + (string-append "--dbdir=" "/var/db/dhcpcd")
> + (string-append "--rundir=" "/var/run/dhcpcd")
> + (string-append "CC=" #$(cc-for-target)))
> + #:phases #~(modify-phases %standard-phases
> + (add-after 'unpack 'do-not-create-dbdir
> + (lambda _
> + ;; Make sure that the Makefile doesn't attempt to create
> + ;; /var/db/dhcpcd for which it doesn't have permissions.
> + (substitute* "src/Makefile"
> + (("\\$\\{INSTALL\\} -m \\$\\{DBMODE\\} -d \\$\\{DESTDIR\\}\\$\\{DBDIR\\}")

I added a \ to avoid being too long

Toggle quote (13 lines)
> + ""))))
> + (add-before 'build 'setenv
> + (lambda _
> + (setenv "HOST_SH" (which "sh"))))
> + (add-after 'install 'wrap-hooks
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + (let* ((out (assoc-ref outputs "out"))
> + (libexec (string-append out "/libexec"))
> + (sed (search-input-file inputs "/bin/sed"))
> + (rm (search-input-file inputs "/bin/rm")))
> + (wrap-program (string-append libexec
> + "/dhcpcd-run-hooks")

adjust to (string-append #$output "/libexec/dhcpcd-run-hooks").

Toggle quote (17 lines)
> + `("PATH" ":" suffix
> + (,(dirname sed)
> + ,(dirname rm))))))))))
> + (home-page "https://roy.marples.name/projects/dhcpcd")
> + (synopsis "Feature-rich DHCP and DHCPv6 client")
> + (description
> + "Provides a DHCP and a DHCPv6 client. Additionally,
> +dhcpcd is also an IPv4LL (aka ZeroConf) client. In layperson's terms,
> +dhcpcd runs on your machine and silently configures your computer to work
> +on the attached networks without trouble and mostly without configuration.")
> + (license license:bsd-2)))
> +
> (define-public radvd
> (package
> (name "radvd")
>
> base-commit: bd24a13c572f1c4cf0e104adc7ca81fe71fee632
pushed, closing.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEfr6klGDOXiwIdX/bO1qpk+Gi3/AFAmeXAvkACgkQO1qpk+Gi
3/CXpA/+K/nn8RGxNgFAGBi5V6Pp5723nO8qTPGIlWRiE4AurdeW2SxolUWDHuBw
FIumeoiH6iiODRWUqV77oWDLY6VFLoAJ1OTpEaPMOpBV2tvJNcYJ0bF3uQvTAS5N
3PljVVCqGl3JjeC8VRoRuJpZp7Ya5cMvfZDe3BEML685sb11rU39VAG7lR2WqVoP
ZuQBOxGwxYnFclRZDxgRuf1PFTne70xXJYPGarRlbHeE7O5/ysR+fqsBcvK4FOzG
mquR9W9EHYj3z1rsQpDCQ8Pr8Fr7FrGZdyXgEHZcIr0dk5R4Xfxs7575eVVuCFbU
N8owzK3BnHIYG/1AM2Z7crPYmQHfzOLN1lnhkaaP9/rjchGcg4E/xR/ZPKVycqLJ
xkpaxYRN0daQLTinZ6ECPX5dJ3cJaLcHuwWaZbKnsalaGQRVxKqsiCQZHE/wAqJi
os3bQlXHzTZwkZdHo2vhomBpIvR3tGVZ5L6AQAkmd1VxkxQl/CggJzJRs36uxlIn
JowuY9O9sg62CklulyBAqdxV2ZJZbOkH7bGCn9EOQis0AG4dgSUpSe6DAgA0CfGD
8PkP3aG4N0cb27rK/Q/kEK2tazy3XlEKMkGsYBoW/qPC9ePHEl3IVtRNje3rGyok
7xLJOCOjYf50JJI3rwHE7lJS3OHr7mEwc/nqj4GzN3EUeP2oV1A=
=cMTo
-----END PGP SIGNATURE-----

Closed
?
Your comment

This issue is archived.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 75494
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
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help