nameserver parsing fix

This commit is contained in:
Eric Litak 2020-11-24 14:54:15 -08:00
parent 10e8dfe80a
commit 1f4ca1ba1a

View file

@ -84,10 +84,7 @@ EOF
extraRules1="" extraRules1=""
fi fi
nameservers=() readarray nameservers < <(grep ^nameserver /etc/resolv.conf | sed -r 's/^nameserver[[:space:]]+([0-9.a-fA-F]+).*/"\1"/')
while IFS='' read -r line; do
nameservers+=("$line")
done < <(grep ^nameserver /etc/resolv.conf | cut -f2 -d' ')
if [[ "$eth0_name" = eth* ]]; then if [[ "$eth0_name" = eth* ]]; then
predictable_inames="usePredictableInterfaceNames = lib.mkForce false;" predictable_inames="usePredictableInterfaceNames = lib.mkForce false;"
@ -99,9 +96,7 @@ EOF
# This file was populated at runtime with the networking # This file was populated at runtime with the networking
# details gathered from the active system. # details gathered from the active system.
networking = { networking = {
nameservers = [$(for a in "${nameservers[@]}"; do echo -n " nameservers = [ ${nameservers[@]} ];
$a"; done)
];
defaultGateway = "${gateway}"; defaultGateway = "${gateway}";
defaultGateway6 = "${gateway6}"; defaultGateway6 = "${gateway6}";
dhcpcd.enable = false; dhcpcd.enable = false;