Added nameservers and error management if no $IFACE found
This commit is contained in:
parent
593a6807f7
commit
052bd68ea0
|
@ -17,3 +17,4 @@ iface eth0 inet manual
|
||||||
allow-hotplug wlan0
|
allow-hotplug wlan0
|
||||||
iface wlan0 inet dhcp
|
iface wlan0 inet dhcp
|
||||||
pre-up /service/sats-wpa
|
pre-up /service/sats-wpa
|
||||||
|
dns-nameservers 8.8.8.8 8.8.4.4
|
||||||
|
|
|
@ -16,15 +16,19 @@ slog ">>> Dynamic Wireless Credentials";
|
||||||
slog "(1) Looking for wireless interface";
|
slog "(1) Looking for wireless interface";
|
||||||
IFACE=`sudo ifconfig -a | grep -P "^w" | awk '{print $1}' | head -n 1`;
|
IFACE=`sudo ifconfig -a | grep -P "^w" | awk '{print $1}' | head -n 1`;
|
||||||
sudo ifconfig $IFACE up;
|
sudo ifconfig $IFACE up;
|
||||||
|
|
||||||
|
# (2) Manage no IFACE found #
|
||||||
|
test -z "$IFACE" && slog " > no wireless IFACE found" && exit;
|
||||||
slog " > got '$IFACE'";
|
slog " > got '$IFACE'";
|
||||||
|
|
||||||
# (2) Get nearest AP matching "SATS_*" and extract HASH #
|
# (3) Get nearest AP matching "SATS_*" and extract HASH #
|
||||||
slog "(2) Looking for nearest AP matching 'SATS_.+'";
|
slog "(2) Looking for nearest AP matching 'SATS_.+'";
|
||||||
AP_HASH=`sudo iwlist $IFACE scan | grep -P "^\s*ESSID:\"SATS_.+\"\s*$" | sed 's/^[ \t]*ESSID:"SATS_//' | sed 's/"[ \t]*$//' | head -n 1`;
|
AP_HASH=`sudo iwlist $IFACE scan | grep -P "^\s*ESSID:\"SATS_.+\"\s*$" | sed 's/^[ \t]*ESSID:"SATS_//' | sed 's/"[ \t]*$//' | head -n 1`;
|
||||||
|
|
||||||
|
# (4) Manage no AP found #
|
||||||
|
test -z "$AP_HASH" && slog " > no AP found" && exit;
|
||||||
slog " > got 'SATS_$AP_HASH'";
|
slog " > got 'SATS_$AP_HASH'";
|
||||||
|
|
||||||
# (3) Manage no AP found #
|
|
||||||
test -z "$AP_HASH" && slog "no AP found" && exit;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue