From 052bd68ea0074e8a90b22a1264f5cceadd89e357 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Thu, 20 Jul 2017 16:17:35 +0200 Subject: [PATCH] Added nameservers and error management if no $IFACE found --- clone/utility/interfaces | 3 ++- clone/utility/sats-wpa | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/clone/utility/interfaces b/clone/utility/interfaces index 8d84792..f639cf7 100644 --- a/clone/utility/interfaces +++ b/clone/utility/interfaces @@ -16,4 +16,5 @@ iface eth0 inet manual # wifi network interface #1 allow-hotplug wlan0 iface wlan0 inet dhcp - pre-up /service/sats-wpa + pre-up /service/sats-wpa + dns-nameservers 8.8.8.8 8.8.4.4 diff --git a/clone/utility/sats-wpa b/clone/utility/sats-wpa index 24e8bcc..ebd6d28 100644 --- a/clone/utility/sats-wpa +++ b/clone/utility/sats-wpa @@ -16,15 +16,19 @@ slog ">>> Dynamic Wireless Credentials"; slog "(1) Looking for wireless interface"; IFACE=`sudo ifconfig -a | grep -P "^w" | awk '{print $1}' | head -n 1`; sudo ifconfig $IFACE up; + +# (2) Manage no IFACE found # +test -z "$IFACE" && slog " > no wireless IFACE found" && exit; 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_.+'"; 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'"; -# (3) Manage no AP found # -test -z "$AP_HASH" && slog "no AP found" && exit;