Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/routing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Warning <moritzwarning@web.de>2016-11-01 04:13:49 +0300
committerMoritz Warning <moritzwarning@web.de>2016-11-01 04:13:49 +0300
commit893890ae2b0e04b68362e1b3976bc1c263d2115a (patch)
treeb600a91c3804f2bf9505fd471db6b27b3c659282 /nodogsplash
parenteb800083264c9115822b5154879ae97d4b04e1cd (diff)
nodogsplash: wait for interface to appear
Diffstat (limited to 'nodogsplash')
-rw-r--r--nodogsplash/Makefile2
-rwxr-xr-xnodogsplash/files/nodogsplash.init18
2 files changed, 19 insertions, 1 deletions
diff --git a/nodogsplash/Makefile b/nodogsplash/Makefile
index 2b8efd2..971fbac 100644
--- a/nodogsplash/Makefile
+++ b/nodogsplash/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=nodogsplash
PKG_FIXUP:=autoreconf
PKG_VERSION:=1.0.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
diff --git a/nodogsplash/files/nodogsplash.init b/nodogsplash/files/nodogsplash.init
index f3df6a1..85bcfcc 100755
--- a/nodogsplash/files/nodogsplash.init
+++ b/nodogsplash/files/nodogsplash.init
@@ -119,6 +119,22 @@ setup_firewall() {
done
}
+wait_for_interface()
+{
+ local ifname="$1"
+ local timeout=10
+ for i in $(seq $timeout); do
+ if [ $(ip -4 addr show dev $ifname 2> /dev/null | grep -c inet) -ne 0 ]; then
+ break
+ fi
+ sleep 1
+ if [ $i == $timeout ] ; then
+ nolog error "$ifname not detected, NoDogSplash not starting."
+ exit 1
+ fi
+ done
+}
+
generate_uci_config() {
local cfg="$1"
local val
@@ -161,6 +177,8 @@ generate_uci_config() {
return 1
fi
+ wait_for_interface "$ifname"
+
echo "GatewayInterface $ifname" >> $CONFIGFILE
append_config_option "$CONFIGFILE" "$cfg" gatewayname