mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-13 10:30:43 +02:00
* 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>
58 lines
2.3 KiB
Diff
58 lines
2.3 KiB
Diff
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
|
|
}
|
|
|