mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-09-27 20:16:22 +02:00
Merge pull request #1372 from adevoss/detect-localip
detect more network interface names for localip (issue #1364)
This commit is contained in:
@@ -35,7 +35,7 @@ function wait_for_local_network() {
|
|||||||
gotLocalIP=0
|
gotLocalIP=0
|
||||||
until [ ${gotLocalIP} -eq 1 ]
|
until [ ${gotLocalIP} -eq 1 ]
|
||||||
do
|
do
|
||||||
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | grep 'eth0\|wlan0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | egrep -i '(*[eth|ens|enp|eno|wlan|wlp][0-9]$)' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
if [ ${#localip} -eq 0 ]; then
|
if [ ${#localip} -eq 0 ]; then
|
||||||
configWifiExists=$(sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 2>/dev/null| grep -c "network=")
|
configWifiExists=$(sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 2>/dev/null| grep -c "network=")
|
||||||
if [ ${configWifiExists} -eq 0 ]; then
|
if [ ${configWifiExists} -eq 0 ]; then
|
||||||
|
@@ -17,7 +17,7 @@ sudo mkdir /mnt/hdd/temp 2>/dev/null
|
|||||||
sudo chmod 777 -R /mnt/hdd/temp 2>/dev/null
|
sudo chmod 777 -R /mnt/hdd/temp 2>/dev/null
|
||||||
|
|
||||||
# localIP
|
# localIP
|
||||||
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | grep 'eth0\|wlan0' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
localip=$(ip addr | grep 'state UP' -A2 | egrep -v 'docker0' | egrep -i '(*[eth|ens|enp|eno|wlan|wlp][0-9]$)' | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
|
||||||
echo "localIP='${localip}'"
|
echo "localIP='${localip}'"
|
||||||
|
|
||||||
# temp - no measurement in a VM
|
# temp - no measurement in a VM
|
||||||
|
Reference in New Issue
Block a user