Skip to content

Commit

Permalink
Improve device selection and dependency check
Browse files Browse the repository at this point in the history
  • Loading branch information
coditva committed Feb 20, 2017
1 parent 443b03c commit d9f95bb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 1 addition & 6 deletions bitsnet
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash


# Load util functions
source ~/.local/lib/bitsnet/util.sh

Expand Down Expand Up @@ -77,14 +76,10 @@ if [[ "$dev" == "0" ]]; then
fi


# Select correct login page according to IP
# and load corresponding login_url
# Nothing to do here for now


# Login
debug_msg ""
debug_msg "Logging in"
# If dev is wifi and IP is not library IP
if [[ "$dev" == "2" && "$(hostname -I)" != "10.20"* ]]; then
# Log into the router
debug_msg "Connected to wifi. Sending request to cisco router form"
Expand Down
12 changes: 11 additions & 1 deletion install
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/bin/sh

# Check if curl and wget installed
# Check if wget installed
if ! which wget > /dev/null ; then
echo "wget not installed"
exit
fi
# Check if git installed for update
if ! which git > /dev/null ; then
echo "git not installed"
exit
fi
# Check if nmcli installed
if ! which nmcli > /dev/null ; then
echo "nmcli not installed"
exit
fi

# Copy config file to the right place
if ! which bitsnet > /dev/null ; then
Expand Down
4 changes: 4 additions & 0 deletions util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ function log_out {

function get_device {
devInfo="$(nmcli dev | grep " connected" | cut -d " " -f1)"
if [[ $devInfo == "virbr"* ]]; then
# If the connection is through a virtual bridge, select the next device
devInfo=$(echo "$devInfo" | sed 1,1d)
fi;
if [[ $devInfo == "en"* ]]; then
# ethernet
dev=1
Expand Down

0 comments on commit d9f95bb

Please sign in to comment.