diff options
author | 2015-12-23 08:05:11 +0000 | |
---|---|---|
committer | 2015-12-23 08:05:11 +0000 | |
commit | e51c9206751892ea8285c12ad8ac3bb167daee3b (patch) | |
tree | 5f14216e927eba51ae4910910fc72e235eb27841 | |
parent | Ensure the installer asks for IPv4 default route in case an interface has (diff) | |
download | wireguard-openbsd-e51c9206751892ea8285c12ad8ac3bb167daee3b.tar.xz wireguard-openbsd-e51c9206751892ea8285c12ad8ac3bb167daee3b.zip |
Ensure the installer asks for the dns domain and nameserver in case an
interface has been configured via dhcp and then again manually.
tested and OK krw@
makes sense halex@
-rw-r--r-- | distrib/miniroot/install.sub | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub index 65773f7ed05..c348b6fced1 100644 --- a/distrib/miniroot/install.sub +++ b/distrib/miniroot/install.sub @@ -1,4 +1,4 @@ -# $OpenBSD: install.sub,v 1.863 2015/12/23 08:00:09 rpe Exp $ +# $OpenBSD: install.sub,v 1.864 2015/12/23 08:05:11 rpe Exp $ # # Copyright (c) 1997-2015 Todd Miller, Theo de Raadt, Ken Westerback # Copyright (c) 2015, Robert Peichaer <rpe@openbsd.org> @@ -1544,23 +1544,27 @@ donetconfig() { done </tmp/resolv.conf fi - # Get & apply fully qualified domain name to hostname. + # Get & apply fqdn to hostname. Don't ask if there's only one configured + # interface and if it's managed by dhclient and if the domain name is + # configured via dhclient too. resp="${_dn:=$(get_fqdn)}" - if [[ ! -f /tmp/dhclient.conf || $NIFS != 1 ]]; then - ask "DNS domain name? (e.g. 'bar.com')" "$resp" - else + if ifconfig dhcp >/dev/null 2>&1 && [[ $NIFS == 1 && -n $_dn ]]; then echo "Using DNS domainname $resp" + else + ask "DNS domain name? (e.g. 'bar.com')" "$resp" fi hostname "$(hostname -s).$resp" - # If only one interface, and it is running dhclient, ask nothing - # else Get/Confirm nameservers. + # Get & add nameservers to /tmp/resolv.conf. Don't ask if there's only + # one configured interface and if it's managed by dhclient and if the + # nameserver is configured via dhclient too. resp="${_ns:=none}" - if [[ ! -f /tmp/dhclient.conf || $NIFS != 1 || $resp == none ]]; then - ask "DNS nameservers? (IP address list or 'none')" "$resp" - else + if ifconfig dhcp >/dev/null 2>&1 && [[ $NIFS == 1 && -n $_ns ]]; then echo "Using DNS nameservers at $resp" + else + ask "DNS nameservers? (IP address list or 'none')" "$resp" fi + # Construct appropriate resolv.conf. if [[ $resp != none ]]; then echo "lookup file bind" >/tmp/resolv.conf |