Skip to content

Commit

Permalink
v7.9
Browse files Browse the repository at this point in the history
+ DietPi-Config | Mute G_GET_NET error if no WiFi or Ethernet adapter is available and fallback to /etc/resolv.conf if dns-nameservers is not present in /etc/network/interfaces
  • Loading branch information
MichaIng committed Dec 11, 2021
1 parent 139cf67 commit 84d6ae4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dietpi/dietpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -2423,9 +2423,10 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges
ETH_GATEWAY_STATIC=$(mawk '$1=="gateway"{print $2;exit}' /etc/network/interfaces)
ETH_MASK_STATIC=$(mawk '$1=="netmask"{print $2;exit}' /etc/network/interfaces)
ETH_DNS_STATIC=$(mawk '$1~/#?dns-nameservers/{print $2,$3;exit}' /etc/network/interfaces)
[[ $ETH_DNS_STATIC ]] || ETH_DNS_STATIC=$(mawk '$1="nameserver"{print $2;exit}' /etc/resolv.conf)
# Remove trailing space in case of single nameserver, due to mawk '{print $2,$3}'
ETH_DNS_STATIC=${ETH_DNS_STATIC%[[:blank:]]}
ETH_DEV_IFACE=$(G_GET_NET -t eth iface) || ETH_DEV_IFACE='eth0'
ETH_DEV_IFACE=$(G_GET_NET -q -t eth iface) || ETH_DEV_IFACE='eth0'
ETH_DISABLED=$(( ! $(grep -Ecm1 "^[[:blank:]]*(allow-hotplug|auto)[[:blank:]]+$ETH_DEV_IFACE" /etc/network/interfaces) ))
ETH_HARDWARE=0
ETH_CONNECTED=0
Expand All @@ -2439,9 +2440,10 @@ NB: All Ethernet connections will be dropped!' && Network_ApplyChanges
WIFI_GATEWAY_STATIC=$(mawk '$1=="gateway"{print $2}' /etc/network/interfaces | mawk 'NR==2')
WIFI_MASK_STATIC=$(mawk '$1=="netmask"{print $2}' /etc/network/interfaces | mawk 'NR==2')
WIFI_DNS_STATIC=$(mawk '$1~/#?dns-nameservers/{print $2,$3}' /etc/network/interfaces | mawk 'NR==2')
[[ $WIFI_DNS_STATIC ]] || WIFI_DNS_STATIC=$(mawk '$1="nameserver"{print $2;exit}' /etc/resolv.conf)
# Remove trailing space in case of single nameserver, due to mawk '{print $2,$3}'
WIFI_DNS_STATIC=${WIFI_DNS_STATIC%[[:blank:]]}
WIFI_DEV_IFACE=$(G_GET_NET -t wlan iface) || WIFI_DEV_IFACE='wlan0'
WIFI_DEV_IFACE=$(G_GET_NET -q -t wlan iface) || WIFI_DEV_IFACE='wlan0'
WIFI_DISABLED=$(( ! $(grep -Ecm1 "^[[:blank:]]*(allow-hotplug|auto)[[:blank:]]+$WIFI_DEV_IFACE" /etc/network/interfaces) ))
WIFI_HARDWARE=0
WIFI_CONNECTED=0
Expand Down

0 comments on commit 84d6ae4

Please sign in to comment.