mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
gnu: isc-dhcp: Patch dhclient to support resolvconf.
* gnu/packages/patches/dhclient-script-resolvconf-support.patch: New patch. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/admin.scm (isc-dhcp): Patch dhclient-script and update wrapper. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
3331d675fb
commit
526b25e09e
2 changed files with 71 additions and 8 deletions
|
@ -1572,7 +1572,9 @@ connection alive.")
|
||||||
version "/dhcp-" version ".tar.gz"))
|
version "/dhcp-" version ".tar.gz"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"1ivkvhhvqxap6c51cli7pa6xn76ngxri1zbl45ishz4ranxidi0a"))))
|
"1ivkvhhvqxap6c51cli7pa6xn76ngxri1zbl45ishz4ranxidi0a"))
|
||||||
|
(patches (search-patches
|
||||||
|
"dhclient-script-resolvconf-support.patch"))))
|
||||||
(build-system gnu-build-system)
|
(build-system gnu-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
`(#:parallel-build? #f
|
`(#:parallel-build? #f
|
||||||
|
@ -1666,12 +1668,13 @@ connection alive.")
|
||||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||||
;; Install the dhclient script for GNU/Linux and make sure
|
;; Install the dhclient script for GNU/Linux and make sure
|
||||||
;; if finds all the programs it needs.
|
;; if finds all the programs it needs.
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(libexec (string-append out "/libexec"))
|
(libexec (string-append out "/libexec"))
|
||||||
(coreutils (assoc-ref inputs "coreutils*"))
|
(coreutils (assoc-ref inputs "coreutils*"))
|
||||||
(inetutils (assoc-ref inputs "inetutils"))
|
(inetutils (assoc-ref inputs "inetutils"))
|
||||||
(grep (assoc-ref inputs "grep*"))
|
(grep (assoc-ref inputs "grep*"))
|
||||||
(sed (assoc-ref inputs "sed*"))
|
(resolvconf (assoc-ref inputs "resolvconf*"))
|
||||||
|
(sed (assoc-ref inputs "sed*"))
|
||||||
(debianutils (assoc-ref inputs "debianutils")))
|
(debianutils (assoc-ref inputs "debianutils")))
|
||||||
(substitute* "client/scripts/linux"
|
(substitute* "client/scripts/linux"
|
||||||
(("/sbin/ip")
|
(("/sbin/ip")
|
||||||
|
@ -1687,7 +1690,8 @@ connection alive.")
|
||||||
,(map (lambda (dir)
|
,(map (lambda (dir)
|
||||||
(string-append dir "/bin:"
|
(string-append dir "/bin:"
|
||||||
dir "/sbin"))
|
dir "/sbin"))
|
||||||
(list inetutils coreutils grep sed debianutils))))))))))
|
(list inetutils coreutils grep sed resolvconf
|
||||||
|
debianutils))))))))))
|
||||||
|
|
||||||
(native-inputs
|
(native-inputs
|
||||||
(list config perl file))
|
(list config perl file))
|
||||||
|
@ -1716,6 +1720,7 @@ connection alive.")
|
||||||
|
|
||||||
("coreutils*" ,coreutils)
|
("coreutils*" ,coreutils)
|
||||||
("grep*" ,grep)
|
("grep*" ,grep)
|
||||||
|
("resolvconf*" ,openresolv)
|
||||||
("sed*" ,sed)))
|
("sed*" ,sed)))
|
||||||
|
|
||||||
(home-page "https://www.isc.org/dhcp/")
|
(home-page "https://www.isc.org/dhcp/")
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
Implement resolvconf support
|
||||||
|
|
||||||
|
Due to the potential for multiple sources contenting for /etc/resolv.conf
|
||||||
|
control, this patch replaces direct file munging with resolvconf indirection.
|
||||||
|
|
||||||
|
--- a/client/scripts/linux 1970-01-01 09:00:01.000000000 +0900
|
||||||
|
+++ b/client/scripts/linux 1970-01-01 09:00:01.000000000 +0900
|
||||||
|
@@ -36,11 +36,11 @@
|
||||||
|
# This updated version mostly follows Debian script by Andrew Pollock et al.
|
||||||
|
make_resolv_conf() {
|
||||||
|
local new_resolv_conf
|
||||||
|
+ new_resolv_conf=$(mktemp)
|
||||||
|
|
||||||
|
# DHCPv4
|
||||||
|
if [ -n "$new_domain_search" ] || [ -n "$new_domain_name" ] ||
|
||||||
|
- [ -n "$new_domain_name_servers" ]; then
|
||||||
|
- new_resolv_conf=/etc/resolv.conf.dhclient-new
|
||||||
|
+ [ -n "$new_domain_name_servers" ]; then
|
||||||
|
rm -f $new_resolv_conf
|
||||||
|
|
||||||
|
if [ -n "$new_domain_name" ]; then
|
||||||
|
@@ -70,17 +70,12 @@
|
||||||
|
echo nameserver $nameserver >>$new_resolv_conf
|
||||||
|
done
|
||||||
|
else # keep 'old' nameservers
|
||||||
|
- sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
|
||||||
|
+ resolvconf -l "$interface.dhcp" | sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p >>$new_resolv_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
- if [ -f /etc/resolv.conf ]; then
|
||||||
|
- chown --reference=/etc/resolv.conf $new_resolv_conf
|
||||||
|
- chmod --reference=/etc/resolv.conf $new_resolv_conf
|
||||||
|
- fi
|
||||||
|
- mv -f $new_resolv_conf /etc/resolv.conf
|
||||||
|
+ resolvconf -a "$interface.dhpc" <"$new_resolv_conf"
|
||||||
|
# DHCPv6
|
||||||
|
elif [ -n "$new_dhcp6_domain_search" ] || [ -n "$new_dhcp6_name_servers" ]; then
|
||||||
|
- new_resolv_conf=/etc/resolv.conf.dhclient-new
|
||||||
|
rm -f $new_resolv_conf
|
||||||
|
|
||||||
|
if [ -n "$new_dhcp6_domain_search" ]; then
|
||||||
|
@@ -97,14 +92,10 @@
|
||||||
|
echo nameserver $nameserver >>$new_resolv_conf
|
||||||
|
done
|
||||||
|
else # keep 'old' nameservers
|
||||||
|
- sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p /etc/resolv.conf >>$new_resolv_conf
|
||||||
|
+ resolvconf -l "$interface.dhcp6" | sed -n /^\w*[Nn][Aa][Mm][Ee][Ss][Ee][Rr][Vv][Ee][Rr]/p >>$new_resolv_conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
- if [ -f /etc/resolv.conf ]; then
|
||||||
|
- chown --reference=/etc/resolv.conf $new_resolv_conf
|
||||||
|
- chmod --reference=/etc/resolv.conf $new_resolv_conf
|
||||||
|
- fi
|
||||||
|
- mv -f $new_resolv_conf /etc/resolv.conf
|
||||||
|
+ resolvconf -a "$interface.dhpc6" <"$new_resolv_conf"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue