50 lines
1.2 KiB
Bash
Raw Normal View History

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