diff mbox series

[bug#41192,1/2] gnu: Add openresolv.

Message ID 20200511185310.24537-1-brice@waegenei.re
State Accepted
Headers show
Series wireguard-tools: Fix wg-quick | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Brice Waegeneire May 11, 2020, 6:53 p.m. UTC
* gnu/packages/dns.scm (openresolv): New variable.
---
 gnu/local.mk                                  |  2 ++
 gnu/packages/dns.scm                          | 34 +++++++++++++++++++
 .../patches/openresolv-restartcmd-guix.patch  | 30 ++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 gnu/packages/patches/openresolv-restartcmd-guix.patch

Comments

Leo Famulari May 11, 2020, 7:52 p.m. UTC | #1
On Mon, May 11, 2020 at 08:53:09PM +0200, Brice Waegeneire wrote:
> +(define-public openresolv

Thanks, it will be great to fix wg-quick.

> +                    (url "git://roy.marples.name/openresolv.git")

We should avoid the Git protocol if possible, preferring, first,
tarballs and, second, HTTPS or HTTP Git URLS. Is that possible for this
package? The Git protocol depends on access to an unusual port, and it's
not private or authenticated.

> diff --git a/gnu/packages/patches/openresolv-restartcmd-guix.patch b/gnu/packages/patches/openresolv-restartcmd-guix.patch

Is this just for sysvinit? If so, can you add a comment saying so? Or
explain the context of the patch a little more?
Brice Waegeneire May 12, 2020, 8:34 p.m. UTC | #2
On 2020-05-11 19:52, Leo Famulari wrote:
> On Mon, May 11, 2020 at 08:53:09PM +0200, Brice Waegeneire wrote:
>> +(define-public openresolv
> 
> Thanks, it will be great to fix wg-quick.
> 
>> +                    (url "git://roy.marples.name/openresolv.git")
> 
> We should avoid the Git protocol if possible, preferring, first,
> tarballs and, second, HTTPS or HTTP Git URLS. Is that possible for this
> package? The Git protocol depends on access to an unusual port, and 
> it's
> not private or authenticated.

Switched to tarball.

>> diff --git a/gnu/packages/patches/openresolv-restartcmd-guix.patch 
>> b/gnu/packages/patches/openresolv-restartcmd-guix.patch
> 
> Is this just for sysvinit? If so, can you add a comment saying so? Or
> explain the context of the patch a little more?

Explained in the patch: it needs to know how to restart nscd so this
patch add support for doing so with shepherd when on a Guix System.
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 90c1c64888..48169fcdb6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -34,6 +34,7 @@ 
 # Copyright © 2020 Felix Gruber <felgru@posteo.net>
 # Copyright © 2020 Ryan Prior <rprior@protonmail.com>
 # Copyright © 2020 Jan Wielkiewicz <tona_kosmicznego_smiecia@interia.pl>
+# Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 #
 # This file is part of GNU Guix.
 #
@@ -1323,6 +1324,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/openmpi-mtl-priorities.patch		\
   %D%/packages/patches/openocd-nrf52.patch			\
   %D%/packages/patches/openssh-hurd.patch			\
+  %D%/packages/patches/openresolv-restartcmd-guix.patch	\
   %D%/packages/patches/openssl-runpath.patch			\
   %D%/packages/patches/openssl-1.1-c-rehash-in.patch		\
   %D%/packages/patches/openssl-c-rehash-in.patch		\
diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index 7ac1611cbf..c33f690b15 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -16,6 +16,7 @@ 
 ;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2020 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Leo Famulari <leo@famulari.name>
+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1001,3 +1002,36 @@  known public suffixes.")
 consists of a UDP-only authoritative DNS server for hosting domains, and a UDP
 and TCP-capable recursive DNS server for finding domains on the internet.")
     (license license:bsd-2)))
+
+(define-public openresolv
+  (package
+    (name "openresolv")
+    (version "3.10.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "git://roy.marples.name/openresolv.git")
+                    (commit (string-append name "-" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1gh7d0lczpxcap4fsxlvy2jxk9km4dg0chidlmgfvxbq61xpagbl"))
+              (patches
+               (search-patches "openresolv-restartcmd-guix.patch"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f                      ; No test suite
+       #:configure-flags
+       (list (string-append "--sysconfdir=/etc"))
+       #:make-flags
+       (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
+    (home-page "https://roy.marples.name/projects/openresolv/")
+    (synopsis "A POSIX resolvconf implementation, a middleman for resolv.conf")
+    (description "openresolv is an implementation of @command{resolvconf}, the
+the middleman between the network configuration services and
+@file{/etc/resolv.conf}.  @command{resolvconf} itself is just a script that
+stores, removes and lists a full @file{resolv.conf} generated for the
+interface.  It then calls all the helper scripts it knows about so it can
+configure the real @file{/etc/resolv.conf} and optionally any local
+nameservers other than libc.")
+    (license license:bsd-2)))
diff --git a/gnu/packages/patches/openresolv-restartcmd-guix.patch b/gnu/packages/patches/openresolv-restartcmd-guix.patch
new file mode 100644
index 0000000000..2fd0e87590
--- /dev/null
+++ b/gnu/packages/patches/openresolv-restartcmd-guix.patch
@@ -0,0 +1,30 @@ 
+From 7f0ce36828ec1e130bee857b8236ca091e4d8a2c Mon Sep 17 00:00:00 2001
+From: Brice Waegeneire <brice@waegenei.re>
+Date: Sat, 9 May 2020 15:52:06 +0200
+Subject: [PATCH] Add RESTARTCMD for Guix System.
+
+---
+ resolvconf.in | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/resolvconf.in b/resolvconf.in
+index 3cad04d..5ef5294 100644
+--- a/resolvconf.in
++++ b/resolvconf.in
+@@ -369,6 +369,13 @@ detect_init()
+ 			then
+ 				/etc/rc.d/$1 restart
+ 			fi'
++	elif [ -e /gnu/store ] && [ -e /run/current-system/profile ]; then
++		# Guix System
++		RESTARTCMD='
++			if /run/current-system/profile/bin/herd status $1 2>&1
++			then
++				/run/current-system/profile/bin/herd restart $1
++			fi'
+ 	else
+ 		for x in /etc/init.d/rc.d /etc/rc.d /etc/init.d; do
+ 			[ -d $x ] || continue
+-- 
+2.26.0
+