unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#52009] [PATCH core-updates-frozen] openresolv: Wrap it.
@ 2021-11-20 23:04 Vivien Kraus via Guix-patches via
  2021-11-22 21:48 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2021-11-20 23:04 UTC (permalink / raw)
  To: 52009


[-- Attachment #1.1: Type: text/plain, Size: 549 bytes --]


Dear guix,

When I boot my system on core-updates-frozen, I get an error message:

/gnu/store/xxx-openresolv-3.12.0/sbin/resolvconf: line 824: mkdir: command not found
Failed to create needed directory /var/run/resolvconf

I didn’t experience any DNS issue, but my network is simple on that
machine. In any case, I think it would do no harm to wrap resolvconf to
set its path to the coreutils so that it can find mkdir and rm. I didn’t
find resolvconf to invoke any other program.

What do you think?

Best regards,

Vivien


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: Wrap resolvconf (openresolv) to set its path --]
[-- Type: text/x-patch, Size: 1789 bytes --]

From 426c613e226b5c7e041d6a8476c09abfeffe151c Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 20 Nov 2021 23:48:17 +0100
Subject: [PATCH] gnu: openresolv: Wrap resolvconf.

* gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
coreutils programs mkdir and rm.
* gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
to run the wrapper and the wrapped script.
---
 gnu/packages/dns.scm | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index b289aa999e..55c6c0d82d 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -1417,7 +1417,18 @@ (define-public openresolv
        #:configure-flags
        (list (string-append "--sysconfdir=/etc"))
        #:make-flags
-       (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
+       (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (coreutils (assoc-ref inputs "coreutils")))
+               (wrap-program (string-append out "/sbin/resolvconf")
+                 `("PATH" ":" = (,(string-append coreutils "/bin"))))))))))
+    (inputs
+     `(("bash-minimal" ,bash-minimal)
+       ("coreutils" ,coreutils)))
     (home-page "https://roy.marples.name/projects/openresolv/")
     (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
     (description "openresolv is an implementation of @command{resolvconf}, the
-- 
2.34.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#52009] [PATCH core-updates-frozen] openresolv: Wrap it.
  2021-11-20 23:04 [bug#52009] [PATCH core-updates-frozen] openresolv: Wrap it Vivien Kraus via Guix-patches via
@ 2021-11-22 21:48 ` Ludovic Courtès
  2021-11-22 22:10   ` Vivien Kraus via Guix-patches via
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2021-11-22 21:48 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 52009

Vivien Kraus <vivien@planete-kraus.eu> skribis:

> From 426c613e226b5c7e041d6a8476c09abfeffe151c Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien@planete-kraus.eu>
> Date: Sat, 20 Nov 2021 23:48:17 +0100
> Subject: [PATCH] gnu: openresolv: Wrap resolvconf.
>
> * gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
> coreutils programs mkdir and rm.
> * gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
> to run the wrapper and the wrapped script.

[...]

> +         (add-after 'install 'wrap-program
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let ((out (assoc-ref outputs "out"))
> +                   (coreutils (assoc-ref inputs "coreutils")))
> +               (wrap-program (string-append out "/sbin/resolvconf")
> +                 `("PATH" ":" = (,(string-append coreutils "/bin"))))))))))
> +    (inputs
> +     `(("bash-minimal" ,bash-minimal)
> +       ("coreutils" ,coreutils)))

Since /sbin/resolvconf is a shell script, how about, instead of wrapping
it, inserting with ‘substitute*’ something like:

  PATH=/gnu/store/…-coreutils/bin:$PATH

somewhere at the top?

That would be more lightweight.

(We could also use ‘coreutils-minimal’ here.)

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#52009] [PATCH core-updates-frozen] openresolv: Wrap it.
  2021-11-22 21:48 ` Ludovic Courtès
@ 2021-11-22 22:10   ` Vivien Kraus via Guix-patches via
  2021-11-22 22:39     ` bug#52009: " Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Vivien Kraus via Guix-patches via @ 2021-11-22 22:10 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 52009

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:
> Vivien Kraus <vivien@planete-kraus.eu> skribis:
>> +         (add-after 'install 'wrap-program
>> +           (lambda* (#:key inputs outputs #:allow-other-keys)
>> +             (let ((out (assoc-ref outputs "out"))
>> +                   (coreutils (assoc-ref inputs "coreutils")))
>> +               (wrap-program (string-append out "/sbin/resolvconf")
>> +                 `("PATH" ":" = (,(string-append coreutils "/bin"))))))))))
>> +    (inputs
>> +     `(("bash-minimal" ,bash-minimal)
>> +       ("coreutils" ,coreutils)))
>
> Since /sbin/resolvconf is a shell script, how about, instead of wrapping
> it, inserting with ‘substitute*’ something like:
>
>   PATH=/gnu/store/…-coreutils/bin:$PATH
>
> somewhere at the top?

Good idea.

> (We could also use ‘coreutils-minimal’ here.)

It contains the required binaries, so let’s go with it.

Vivien


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Warpping openresolv, with coreutils-minimal and shell code --]
[-- Type: text/x-patch, Size: 1860 bytes --]

From 8b26dda4284de0c3db8aa40c5d9ddd6130ded590 Mon Sep 17 00:00:00 2001
From: Vivien Kraus <vivien@planete-kraus.eu>
Date: Sat, 20 Nov 2021 23:48:17 +0100
Subject: [PATCH] gnu: openresolv: Wrap resolvconf.

* gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
coreutils programs mkdir and rm.
* gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
to run the wrapper and the wrapped script.
---
 gnu/packages/dns.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/dns.scm b/gnu/packages/dns.scm
index b289aa999e..f025b2242b 100644
--- a/gnu/packages/dns.scm
+++ b/gnu/packages/dns.scm
@@ -1417,7 +1417,22 @@ (define-public openresolv
        #:configure-flags
        (list (string-append "--sysconfdir=/etc"))
        #:make-flags
-       (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))))
+       (list (string-append "SYSCONFDIR=/" (assoc-ref %outputs "out") "/etc"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out"))
+                   (coreutils (assoc-ref inputs "coreutils-minimal")))
+               (substitute* (string-append out "/sbin/resolvconf")
+                 (("RESOLVCONF=\"\\$0\"")
+                  (format #f "\
+RESOLVCONF=\"$0\"
+PATH=~a/bin:$PATH"
+                          coreutils)))))))))
+    (inputs
+     `(("bash-minimal" ,bash-minimal)
+       ("coreutils-minimal" ,coreutils-minimal)))
     (home-page "https://roy.marples.name/projects/openresolv/")
     (synopsis "Resolvconf POSIX compliant implementation, a middleman for resolv.conf")
     (description "openresolv is an implementation of @command{resolvconf}, the
-- 
2.34.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#52009: [PATCH core-updates-frozen] openresolv: Wrap it.
  2021-11-22 22:10   ` Vivien Kraus via Guix-patches via
@ 2021-11-22 22:39     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2021-11-22 22:39 UTC (permalink / raw)
  To: Vivien Kraus; +Cc: 52009-done

Vivien Kraus <vivien@planete-kraus.eu> skribis:

>>From 8b26dda4284de0c3db8aa40c5d9ddd6130ded590 Mon Sep 17 00:00:00 2001
> From: Vivien Kraus <vivien@planete-kraus.eu>
> Date: Sat, 20 Nov 2021 23:48:17 +0100
> Subject: [PATCH] gnu: openresolv: Wrap resolvconf.
>
> * gnu/packages/dns.scm (openresolv) [phases]: Wrap resolvconf to set PATH, for
> coreutils programs mkdir and rm.
> * gnu/packages/dns.scm (openresolv) [inputs]: Add coreutils, and bash-minimal
> to run the wrapper and the wrapped script.

That was fast!  Applied without “bash-minimal” (it’s no longer needed.)

Thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-22 22:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-20 23:04 [bug#52009] [PATCH core-updates-frozen] openresolv: Wrap it Vivien Kraus via Guix-patches via
2021-11-22 21:48 ` Ludovic Courtès
2021-11-22 22:10   ` Vivien Kraus via Guix-patches via
2021-11-22 22:39     ` bug#52009: " Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).