#!/bin/bash
# Copyright 2013 Monterey Bay Aquarium Research Institute, all rights reserved.


# Get power port and serial port from configuration
radio=wifi
powerSerial=`python /home/hotspot/smc-script/modemConfig.py $MODEM_CONFIG_FILE $radio`
if [ $? != 0 ]; then
   echo $powerSerial
   echo Could not get configuration for $radio radio
   exit 1
fi

# Get power port
powerPort=`echo $powerSerial | awk '{print $1}'`

# No serial port...

# Turn on WiFi radio
echo Turning WiFi radio on
/home/smc/bin/SetPowerSwitch $powerPort 1

# Wait for radio to power up
sleep 5

# Enable Ethernet 
echo Enabling Ethernet
/home/smc/bin/EnableEthernet

# Should have DHCP address at this point

# Don't want to route through 802.11
echo 'Remove routing through ethernet to avoid conflict with cell modem'
route del default eth0
echo route:
route -n


