ttn-resin-gateway-rpi/build.sh
2016-03-25 14:21:04 -04:00

50 lines
1.2 KiB
Bash
Executable File

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