2016-03-22 04:38:11 +00:00
|
|
|
#! /bin/bash
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2016-03-25 18:21:04 +00:00
|
|
|
# Stop on the first sign of trouble!
|
2016-03-21 19:36:55 +00:00
|
|
|
set -e
|
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
echo "The Things Network RPi + IC880A Gateway Builder/Installer"
|
2016-03-21 21:06:34 +00:00
|
|
|
echo ""
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
# Build in a temp folder that we'll completely purge after build,
|
|
|
|
# and install into the linux folder where apps reside.
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2016-03-25 14:06:47 +00:00
|
|
|
BUILD_DIR="/tmp/ttn-gateway"
|
2016-03-25 14:29:49 +00:00
|
|
|
mkdir $BUILD_DIR
|
2016-03-25 14:06:47 +00:00
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
INSTALL_DIR="/opt/ttn-gateway"
|
|
|
|
mkdir $INSTALL_DIR
|
2016-03-25 14:06:47 +00:00
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
# Switch to where we'll do the builds
|
2016-03-25 14:06:47 +00:00
|
|
|
pushd $BUILD_DIR
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
# Build WiringPi so that we can do Raspberry Pi I/O
|
|
|
|
git clone git://git.drogon.net/wiringPi
|
|
|
|
pushd wiringPi
|
2016-03-25 13:45:32 +00:00
|
|
|
./build
|
2016-03-21 19:36:55 +00:00
|
|
|
popd
|
|
|
|
|
2016-03-25 14:06:47 +00:00
|
|
|
# Build LoRa gateway app for this specific platform
|
2016-03-25 14:29:49 +00:00
|
|
|
git clone https://github.com/TheThingsNetwork/lora_gateway.git
|
|
|
|
pushd lora_gateway
|
2016-03-25 13:45:32 +00:00
|
|
|
sed -i -e 's/PLATFORM= kerlink/PLATFORM= imst_rpi/g' ./libloragw/library.cfg
|
2016-03-21 19:36:55 +00:00
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
# Build the packet forwarder
|
|
|
|
git clone https://github.com/TheThingsNetwork/packet_forwarder.git
|
|
|
|
pushd packet_forwarder
|
2016-03-21 19:36:55 +00:00
|
|
|
make
|
|
|
|
popd
|
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
# Restore location back to where we were prior to starting the build
|
2016-03-21 22:04:58 +00:00
|
|
|
popd
|
2016-03-21 21:56:23 +00:00
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
# Copy packet forwarder to where it'll be expected
|
2016-03-25 14:14:19 +00:00
|
|
|
cp $BUILD_DIR/packet_forwarder/poly_pkt_fwd/poly_pkt_fwd $INSTALL_DIR/poly_pkt_fwd
|
2016-03-25 14:06:47 +00:00
|
|
|
|
2016-03-25 14:14:19 +00:00
|
|
|
# Delete the build folder so that we save space
|
2016-03-25 14:06:47 +00:00
|
|
|
rm -rf $BUILD_DIR
|
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
echo "Build & Installation Completed."
|