True first version

This commit is contained in:
Ray Ozzie 2016-03-25 14:21:04 -04:00
parent bb1e4d37a4
commit 80800ba1a7
3 changed files with 11 additions and 9 deletions

View File

@ -3,9 +3,9 @@ FROM resin/raspberrypi-buildpack-deps
# Enable systemd, as Resin requires this # Enable systemd, as Resin requires this
ENV INITSYSTEM on ENV INITSYSTEM on
# Version number of gateway software # Version number of gateway software.
# (Incrementing this simply forces Docker to flush its cache # (Incrementing this simply forces Docker to flush its cache
# and thus forces a full rebuild.) # and thus forces a full rebuild. Not used outside of Dockerfile.)
ENV TTN_GATEWAY_SOFTWARE 45 ENV TTN_GATEWAY_SOFTWARE 45
# Build the gateway # Build the gateway

View File

@ -1,6 +1,6 @@
#! /bin/bash #! /bin/bash
# Stop on the first sign of trouble # Stop on the first sign of trouble!
set -e set -e
echo "The Things Network RPi + IC880A Gateway Builder/Installer" echo "The Things Network RPi + IC880A Gateway Builder/Installer"

14
run.sh
View File

@ -1,6 +1,6 @@
#! /bin/bash #! /bin/bash
# Configure the global and local configuration files via the environment # Ensure that we've got the required env vars
echo "*******************" echo "*******************"
echo "*** Configuration:" echo "*** Configuration:"
@ -45,7 +45,7 @@ fi
echo "******************" echo "******************"
echo "" echo ""
# load the region-appropriate global conf # Load the region-appropriate global conf
if curl -sS --fail https://raw.githubusercontent.com/TheThingsNetwork/gateway-conf/master/$GW_REGION-global_conf.json --output ./global_conf.json if curl -sS --fail https://raw.githubusercontent.com/TheThingsNetwork/gateway-conf/master/$GW_REGION-global_conf.json --output ./global_conf.json
then then
@ -58,7 +58,7 @@ else
exit 1 exit 1
fi fi
# fetch location info, which we'll use as a hint to the gateway software # Fetch location info, which we'll use as a hint to the gateway software
if curl -sS --fail ipinfo.io --output ./ipinfo.json if curl -sS --fail ipinfo.io --output ./ipinfo.json
then then
@ -70,7 +70,7 @@ else
IPINFO="\"\"" IPINFO="\"\""
fi fi
# set up environmental defaults for local.conf # Set up environmental defaults for local.conf
if [[ $GW_GPS == "" ]]; then GW_GPS="true"; fi if [[ $GW_GPS == "" ]]; then GW_GPS="true"; fi
if [[ $GW_BEACON == "" ]]; then GW_BEACON="false"; fi if [[ $GW_BEACON == "" ]]; then GW_BEACON="false"; fi
@ -109,7 +109,7 @@ if [[ $GW_SYSTEM_CALLS == "" ]]; then GW_SYSTEM_CALLS="[\"df -m\",\"free -h\",\"
if [[ $GW_PLATFORM == "" ]]; then GW_PLATFORM="\"*\""; fi if [[ $GW_PLATFORM == "" ]]; then GW_PLATFORM="\"*\""; fi
# create local.conf # Synthesize local.conf JSON from env vars
echo -e "{\n\ echo -e "{\n\
\t\"gateway_conf\": {\n\ \t\"gateway_conf\": {\n\
@ -149,7 +149,7 @@ echo -e "{\n\
\t}\n\ \t}\n\
}" >./local_conf.json }" >./local_conf.json
# Reset gateway ID based on MAC # Set gateway_ID in local_conf.json to the gateway's MAC address
echo "******************" echo "******************"
../packet_forwarder/reset_pkt_fwd.sh start ./local_conf.json ../packet_forwarder/reset_pkt_fwd.sh start ./local_conf.json
@ -157,12 +157,14 @@ echo "******************"
echo "" echo ""
# Test the connection, wait if needed. # Test the connection, wait if needed.
while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do while [[ $(ping -c1 google.com 2>&1 | grep " 0% packet loss") == "" ]]; do
echo "[TTN Gateway]: Waiting for internet connection..." echo "[TTN Gateway]: Waiting for internet connection..."
sleep 30 sleep 30
done done
# Fire up the forwarder. # Fire up the forwarder.
while true while true
do do
echo "[TTN Gateway]: Starting packet forwarder..." echo "[TTN Gateway]: Starting packet forwarder..."