summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2021-08-02 01:29:27 +0000
committerkn <kn@cvs.openbsd.org>2021-08-02 01:29:27 +0000
commitf87ebdb8ed800fb8ccc7e447aa0901e716979ede (patch)
treeac6d233167e8154710e62d644425a6f4707acdeb /distrib
parent4d31e994aafefae2b8920ccb4185274588266b14 (diff)
Leave resolv.conf to resolvd if it learned nameservers
During install (not upgrade) the installer parses resolv.conf looking for nameservers, FQDN and domain information; it also prompts for nameservers if none were found. If DHCP is used and nameservers were found, resolv.conf gets recreated from scratch. Under dhclient(8) this was fine, but resolvd(8) persists learned proposals across such file modifications and resolv.conf will thus contain a mix between managed and manual entries -- stale duplicates which users have to remove manually. Do not touch resolv.conf anymore in case resolvd knows better and thus provide a clean file for installations. OK florian
Diffstat (limited to 'distrib')
-rw-r--r--distrib/miniroot/install.sub10
1 files changed, 8 insertions, 2 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index fb95222fef5..757b95ae469 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sub,v 1.1169 2021/07/20 11:20:09 kn Exp $
+# $OpenBSD: install.sub,v 1.1170 2021/08/02 01:29:26 kn Exp $
#
# Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback
# Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org>
@@ -2052,7 +2052,7 @@ set_term() {
# Configure the network.
donetconfig() {
- local _dn _ns _f1 _f2 _f3
+ local _dn _ns _f1 _f2 _f3 _autoconf_ns=false
configure_ifs
v4_defroute
@@ -2065,6 +2065,7 @@ donetconfig() {
# domain given on *last* search or domain statement.
while read -r -- _f1 _f2 _f3; do
[[ $_f1 == nameserver ]] && _ns="${_ns:+$_ns }$_f2"
+ [[ $_f3 == '# resolvd: '* ]] && _autoconf_ns=true
[[ $_f1 == @(domain|search) ]] && _dn=$_f2
done </etc/resolv.conf
fi
@@ -2086,6 +2087,11 @@ donetconfig() {
fi
hostname "$(hostname -s).$resp"
+ if $_autoconf_ns && [[ -n $_ns ]]; then
+ echo "Using DNS nameservers at $_ns"
+ return
+ fi
+
# Get & add nameservers to /tmp/resolv.conf. Don't ask if there's only
# one configured interface and if it's managed by dhcp and if the
# nameserver is configured via dhcp too.