2016-03-22 04:38:11 +00:00
|
|
|
#! /bin/bash
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2017-02-25 17:12:29 +00:00
|
|
|
INSTALL_DIR="/opt/ttn-gateway"
|
|
|
|
|
|
|
|
mkdir -p $INSTALL_DIR/dev
|
|
|
|
cd $INSTALL_DIR/dev
|
|
|
|
|
|
|
|
if [ ! -d lora_gateway ]; then
|
2017-02-26 20:03:44 +00:00
|
|
|
git clone https://github.com/kersing/lora_gateway.git || { echo 'Cloning lora_gateway failed.' ; exit 1; }
|
2017-02-25 17:12:29 +00:00
|
|
|
else
|
|
|
|
cd lora_gateway
|
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d paho.mqtt.embedded-c ]; then
|
2017-02-26 20:03:44 +00:00
|
|
|
git clone https://github.com/kersing/paho.mqtt.embedded-c.git || { echo 'Cloning paho mqtt failed.' ; exit 1; }
|
2017-02-25 17:12:29 +00:00
|
|
|
else
|
|
|
|
cd paho.mqtt.embedded-c
|
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d ttn-gateway-connector ]; then
|
2017-02-26 20:03:44 +00:00
|
|
|
git clone https://github.com/kersing/ttn-gateway-connector.git || { echo 'Cloning gateway connector failed.' ; exit 1; }
|
2017-02-25 17:12:29 +00:00
|
|
|
else
|
|
|
|
cd ttn-gateway-connector
|
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d protobuf-c ]; then
|
2017-02-26 20:03:44 +00:00
|
|
|
git clone https://github.com/kersing/protobuf-c.git || { echo 'Cloning protobuf-c failed.' ; exit 1; }
|
2017-02-25 17:12:29 +00:00
|
|
|
else
|
|
|
|
cd protobuf-c
|
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d packet_forwarder ]; then
|
2017-02-26 20:03:44 +00:00
|
|
|
git clone https://github.com/kersing/packet_forwarder.git || { echo 'Cloning packet forwarder failed.' ; exit 1; }
|
2017-02-25 17:12:29 +00:00
|
|
|
else
|
|
|
|
cd packet_forwarder
|
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d protobuf ]; then
|
2017-02-26 20:03:44 +00:00
|
|
|
git clone https://github.com/google/protobuf.git || { echo 'Cloning protobuf failed.' ; exit 1; }
|
2017-02-25 17:12:29 +00:00
|
|
|
else
|
|
|
|
cd protobuf
|
|
|
|
git reset --hard
|
|
|
|
git pull
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $INSTALL_DIR/dev/lora_gateway/libloragw
|
2017-02-24 23:01:00 +00:00
|
|
|
sed -i -e 's/PLATFORM= .*$/PLATFORM= imst_rpi/g' library.cfg
|
|
|
|
sed -i -e 's/CFG_SPI= .*$/CFG_SPI= native/g' library.cfg
|
2018-02-12 17:32:11 +00:00
|
|
|
make -j$(nproc)
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2017-02-25 17:12:29 +00:00
|
|
|
cd $INSTALL_DIR/dev/protobuf-c
|
2017-02-24 23:01:00 +00:00
|
|
|
./autogen.sh
|
|
|
|
./configure
|
|
|
|
make protobuf-c/libprotobuf-c.la
|
|
|
|
mkdir bin
|
|
|
|
./libtool install /usr/bin/install -c protobuf-c/libprotobuf-c.la `pwd`/bin
|
2017-02-25 22:50:37 +00:00
|
|
|
rm -f `pwd`/bin/*so*
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2017-02-25 17:12:29 +00:00
|
|
|
cd $INSTALL_DIR/dev/paho.mqtt.embedded-c/
|
2016-03-21 19:36:55 +00:00
|
|
|
make
|
2017-02-24 23:01:00 +00:00
|
|
|
make install
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2017-02-25 17:12:29 +00:00
|
|
|
cd $INSTALL_DIR/dev/ttn-gateway-connector
|
2017-02-24 23:01:00 +00:00
|
|
|
cp config.mk.in config.mk
|
2018-02-12 17:32:11 +00:00
|
|
|
make -j$(nproc)
|
2017-02-24 23:01:00 +00:00
|
|
|
cp bin/libttn-gateway-connector.so /usr/lib/
|
2016-03-21 19:36:55 +00:00
|
|
|
|
2017-02-25 17:12:29 +00:00
|
|
|
cd $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/
|
2018-02-12 17:32:11 +00:00
|
|
|
make -j$(nproc)
|
2016-03-25 14:06:47 +00:00
|
|
|
|
2017-02-25 23:27:49 +00:00
|
|
|
# Copy things needed at runtime to where they'll be expected
|
2017-02-26 00:04:40 +00:00
|
|
|
cp $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/mp_pkt_fwd $INSTALL_DIR/mp_pkt_fwd
|
2017-02-25 23:27:49 +00:00
|
|
|
|
2016-03-25 14:29:49 +00:00
|
|
|
echo "Build & Installation Completed."
|