simplify build script
This commit is contained in:
parent
715f30310c
commit
f1a2c8ef95
@ -4,8 +4,8 @@ FROM resin/raspberrypi-buildpack-deps
|
||||
ENV INITSYSTEM on
|
||||
|
||||
# Build the gateway
|
||||
COPY build.sh /ttn-gateway/build.sh
|
||||
WORKDIR /ttn-gateway
|
||||
COPY build.sh /tmp/build.sh
|
||||
WORKDIR /tmp
|
||||
RUN ./build.sh
|
||||
|
||||
# Copy the run shell script after build, so we can modify it without rebuilding
|
||||
|
@ -9,8 +9,8 @@ WORKDIR /ttn-gateway
|
||||
RUN ./build.sh
|
||||
|
||||
# Copy the run shell script after build, so we can modify it without rebuilding
|
||||
COPY run.sh /opt/ttn-gateway/bin/run.sh
|
||||
WORKDIR /opt/ttn-gateway/bin
|
||||
COPY run.sh /opt/ttn-gateway/run.sh
|
||||
WORKDIR /opt/ttn-gateway
|
||||
|
||||
# Start it up
|
||||
CMD ["sh", "-c", "./run.sh"]
|
||||
|
1
build.sh
1
build.sh
@ -28,7 +28,6 @@ popd
|
||||
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
|
||||
# sed -i -e 's/DEBUG_HAL= 0/DEBUG_HAL= 1/g' ./libloragw/library.cfg
|
||||
make
|
||||
popd
|
||||
|
||||
|
56
build.sh~
56
build.sh~
@ -3,80 +3,48 @@
|
||||
# Stop on the first sign of trouble
|
||||
set -e
|
||||
|
||||
if [ $UID != 0 ]; then
|
||||
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 "The Things Network RPi + IC880A Gateway Builder/Installer"
|
||||
echo ""
|
||||
|
||||
# We will build in a place that we will purge after build,
|
||||
# and will install just the required files in the appropriate place
|
||||
# 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
|
||||
|
||||
if [ ! -d "$INSTALL_DIR" ]; then mkdir $INSTALL_DIR; fi
|
||||
if [ ! -d "$BUILD_DIR" ]; then mkdir $BUILD_DIR; fi
|
||||
|
||||
# Switch to where we'll do the builds
|
||||
pushd $BUILD_DIR
|
||||
|
||||
# Build WiringPi
|
||||
if [ ! -d wiringPi ]; then
|
||||
# Build WiringPi so that we can do Raspberry Pi I/O
|
||||
git clone git://git.drogon.net/wiringPi
|
||||
pushd wiringPi
|
||||
else
|
||||
pushd wiringPi
|
||||
git reset --hard
|
||||
git pull
|
||||
fi
|
||||
|
||||
./build
|
||||
|
||||
popd
|
||||
|
||||
# Build LoRa gateway app for this specific platform
|
||||
if [ ! -d lora_gateway ]; then
|
||||
git clone https://github.com/TheThingsNetwork/lora_gateway.git
|
||||
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/DEBUG_HAL= 0/DEBUG_HAL= 1/g' ./libloragw/library.cfg
|
||||
|
||||
make
|
||||
|
||||
popd
|
||||
|
||||
# Build packet forwarder
|
||||
if [ ! -d packet_forwarder ]; then
|
||||
# Build the packet forwarder
|
||||
git clone https://github.com/TheThingsNetwork/packet_forwarder.git
|
||||
pushd packet_forwarder
|
||||
else
|
||||
pushd packet_forwarder
|
||||
git pull
|
||||
git reset --hard
|
||||
fi
|
||||
|
||||
make
|
||||
|
||||
popd
|
||||
|
||||
# Restore location back to where we started the build
|
||||
# Restore location back to where we were prior to starting the build
|
||||
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
|
||||
|
||||
# Delete the build folder so that we save space
|
||||
rm -rf $BUILD_DIR
|
||||
|
||||
echo "Build completed."
|
||||
echo "Build & Installation Completed."
|
||||
|
Loading…
Reference in New Issue
Block a user