This commit is contained in:
Ray Ozzie 2016-03-25 10:06:47 -04:00
parent af8476e980
commit 0e80872742
2 changed files with 27 additions and 31 deletions

View File

@ -14,16 +14,16 @@ if [[ $1 != "" ]]; then VERSION=$1; fi
echo "The Things Network Gateway installer" echo "The Things Network Gateway installer"
echo "" echo ""
# Check dependencies # We will build in a place that we will purge after build,
echo "Installing dependencies..." # and will install just the required files in the appropriate place
#apt-get update
#apt-get install swig libftdi-dev python-dev
#apt-get install swig python-dev
# Install LoRaWAN packet forwarder repositories BUILD_DIR="/tmp/ttn-gateway"
INSTALL_DIR="/opt/ttn-gateway" INSTALL_DIR="/opt/ttn-gateway"
if [ ! -d "$INSTALL_DIR" ]; then mkdir $INSTALL_DIR; fi if [ ! -d "$INSTALL_DIR" ]; then mkdir $INSTALL_DIR; fi
pushd $INSTALL_DIR if [ ! -d "$BUILD_DIR" ]; then mkdir $BUILD_DIR; fi
pushd $BUILD_DIR
# Build WiringPi # Build WiringPi
if [ ! -d wiringPi ]; then if [ ! -d wiringPi ]; then
@ -39,7 +39,7 @@ fi
popd popd
# Build LoRa gateway app # Build LoRa gateway app for this specific platform
if [ ! -d lora_gateway ]; then if [ ! -d lora_gateway ]; then
git clone https://github.com/TheThingsNetwork/lora_gateway.git git clone https://github.com/TheThingsNetwork/lora_gateway.git
pushd lora_gateway pushd lora_gateway
@ -50,7 +50,7 @@ else
fi fi
sed -i -e 's/PLATFORM= kerlink/PLATFORM= imst_rpi/g' ./libloragw/library.cfg sed -i -e 's/PLATFORM= kerlink/PLATFORM= imst_rpi/g' ./libloragw/library.cfg
sed -i -e 's/DEBUG_HAL= 0/DEBUG_HAL= 1/g' ./libloragw/library.cfg # sed -i -e 's/DEBUG_HAL= 0/DEBUG_HAL= 1/g' ./libloragw/library.cfg
make make
@ -70,13 +70,16 @@ make
popd popd
# Symlink poly packet forwarder # Copy packet forwarder to where we will need it
if [ ! -d bin ]; then mkdir bin; fi
if [ -f ./bin/poly_pkt_fwd ]; then rm ./bin/poly_pkt_fwd; fi if [ -f ./bin/poly_pkt_fwd ]; then rm ./bin/poly_pkt_fwd; fi
ln -s $INSTALL_DIR/packet_forwarder/poly_pkt_fwd/poly_pkt_fwd ./bin/poly_pkt_fwd cp ./poly_pkt_fwd $INSTALL_DIR/poly_pkt_fwd
# Restore location back to where we started the install # Restore location back to where we started the build
popd popd
echo "Installation completed." # Delete the build folder so that we save space
rm -rf $BUILD_DIR
echo "Build completed."

View File

@ -16,28 +16,26 @@ echo ""
# Check dependencies # Check dependencies
echo "Installing dependencies..." echo "Installing dependencies..."
apt-get update #apt-get update
apt-get install swig libftdi-dev python-dev #apt-get install swig libftdi-dev python-dev
#apt-get install swig python-dev
# Install LoRaWAN packet forwarder repositories # Install LoRaWAN packet forwarder repositories
INSTALL_DIR="/opt/ttn-gateway" INSTALL_DIR="/opt/ttn-gateway"
if [ ! -d "$INSTALL_DIR" ]; then mkdir $INSTALL_DIR; fi if [ ! -d "$INSTALL_DIR" ]; then mkdir $INSTALL_DIR; fi
pushd $INSTALL_DIR pushd $INSTALL_DIR
# Build libraries # Build WiringPi
if [ ! -d libmpsse ]; then if [ ! -d wiringPi ]; then
git clone https://github.com/devttys0/libmpsse.git git clone git://git.drogon.net/wiringPi
pushd libmpsse/src pushd wiringPi
else else
pushd libmpsse/src pushd wiringPi
git reset --hard git reset --hard
git pull git pull
fi fi
./configure --disable-python ./build
make
make install
ldconfig
popd popd
@ -51,13 +49,8 @@ else
git pull git pull
fi fi
cp ./libloragw/99-libftdi.rules /etc/udev/rules.d/99-libftdi.rules sed -i -e 's/PLATFORM= kerlink/PLATFORM= imst_rpi/g' ./libloragw/library.cfg
sed -i -e 's/CFG_SPI= native/CFG_SPI= ftdi/g' ./libloragw/library.cfg
#sed -i -e 's/PLATFORM= kerlink/PLATFORM= imst_rpi/g' ./libloragw/library.cfg
sed -i -e 's/PLATFORM= kerlink/PLATFORM= lorank/g' ./libloragw/library.cfg
sed -i -e 's/DEBUG_HAL= 0/DEBUG_HAL= 1/g' ./libloragw/library.cfg sed -i -e 's/DEBUG_HAL= 0/DEBUG_HAL= 1/g' ./libloragw/library.cfg
sed -i -e 's/ATTRS{idProduct}=="6010"/ATTRS{idProduct}=="6014"/g' /etc/udev/rules.d/99-libftdi.rules
make make