summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-03-07 22:23:54 (GMT)
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-03-10 19:40:27 (GMT)
commit3abf8a36314a2bec05dbaeef9c43d73263dde9c1 (patch)
tree080a63b141e0457bc2b3fb33514f63e2580911b1
parentad715ec018f7b9c7e1f8fff0df8aef24a08b1f1a (diff)
downloaduser-scripts-3abf8a36314a2bec05dbaeef9c43d73263dde9c1.zip
user-scripts-3abf8a36314a2bec05dbaeef9c43d73263dde9c1.tar.gz
user-scripts-3abf8a36314a2bec05dbaeef9c43d73263dde9c1.tar.bz2
usb/networking: abort if no gateway is found
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rw-r--r--networking/usb/usb_networking_device.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/networking/usb/usb_networking_device.sh b/networking/usb/usb_networking_device.sh
index 254bd4e..8351c26 100644
--- a/networking/usb/usb_networking_device.sh
+++ b/networking/usb/usb_networking_device.sh
@@ -51,6 +51,13 @@ clear_iface () {
setup_iface () {
gateway=$(ip route show 0.0.0.0/0 dev $USB_IFACE | cut -d\ -f3)
+
+ if [ "$gateway" = "" ]; then
+ echo "Error: no route available"
+ echo "Make sure your PC is configured correctly for usb networking"
+ exit 1
+ fi
+
echo "Your gateway is $gateway"
ndc network create 1
ndc network interface add 1 "$USB_IFACE"