simplify build script

This commit is contained in:
Ray Ozzie 2016-03-25 10:29:49 -04:00
parent 986da06503
commit 715f30310c
2 changed files with 21 additions and 56 deletions

View File

@ -3,80 +3,48 @@
# Stop on the first sign of trouble # Stop on the first sign of trouble
set -e set -e
if [ $UID != 0 ]; then echo "The Things Network RPi + IC880A Gateway Builder/Installer"
echo "ERROR: Operation not permitted. Forgot sudo?"
exit 1
fi
VERSION="master"
if [[ $1 != "" ]]; then VERSION=$1; fi
echo "The Things Network Gateway installer"
echo "" echo ""
# We will build in a place that we will purge after build, # Build in a temp folder that we'll completely purge after build,
# and will install just the required files in the appropriate place # and install into the linux folder where apps reside.
BUILD_DIR="/tmp/ttn-gateway" BUILD_DIR="/tmp/ttn-gateway"
mkdir $BUILD_DIR
INSTALL_DIR="/opt/ttn-gateway" INSTALL_DIR="/opt/ttn-gateway"
mkdir $INSTALL_DIR
if [ ! -d "$INSTALL_DIR" ]; then mkdir $INSTALL_DIR; fi # Switch to where we'll do the builds
if [ ! -d "$BUILD_DIR" ]; then mkdir $BUILD_DIR; fi
pushd $BUILD_DIR pushd $BUILD_DIR
# Build WiringPi # Build WiringPi so that we can do Raspberry Pi I/O
if [ ! -d wiringPi ]; then git clone git://git.drogon.net/wiringPi
git clone git://git.drogon.net/wiringPi pushd wiringPi
pushd wiringPi
else
pushd wiringPi
git reset --hard
git pull
fi
./build ./build
popd popd
# Build LoRa gateway app for this specific platform # Build LoRa gateway app for this specific platform
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
else
pushd lora_gateway
git reset --hard
git pull
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
popd popd
# Build packet forwarder # Build the packet forwarder
if [ ! -d packet_forwarder ]; then git clone https://github.com/TheThingsNetwork/packet_forwarder.git
git clone https://github.com/TheThingsNetwork/packet_forwarder.git pushd packet_forwarder
pushd packet_forwarder
else
pushd packet_forwarder
git pull
git reset --hard
fi
make make
popd popd
# Restore location back to where we started the build # Restore location back to where we were prior to starting the build
popd popd
# Copy packet forwarder to where we will need it # 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 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 # Delete the build folder so that we save space
rm -rf $BUILD_DIR rm -rf $BUILD_DIR
echo "Build completed." echo "Build & Installation Completed."

View File

@ -70,16 +70,13 @@ make
popd popd
# Copy packet forwarder to where we will need it
if [ -f ./bin/poly_pkt_fwd ]; then rm ./bin/poly_pkt_fwd; fi
cp ./poly_pkt_fwd $INSTALL_DIR/poly_pkt_fwd
# Restore location back to where we started the build # Restore location back to where we started the build
popd popd
# Delete the build folder so that we save space # Copy packet forwarder to where we will need it
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 rm -rf $BUILD_DIR
echo "Build completed." echo "Build completed."