Set EUI using device MAC address. Copy mp_pkt_fwd to correct location.

This commit is contained in:
JP Meijers 2017-02-25 23:27:49 +00:00
parent 5d6a05b91f
commit 3393efe1b6
2 changed files with 15 additions and 6 deletions

View File

@ -98,4 +98,7 @@ cp bin/libttn-gateway-connector.so /usr/lib/
cd $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/ cd $INSTALL_DIR/dev/packet_forwarder/mp_pkt_fwd/
make make
# Copy things needed at runtime to where they'll be expected
cp $BUILD_DIR/packet_forwarder/mp_pkt_fwd/mp_pkt_fwd $INSTALL_DIR/mp_pkt_fwd
echo "Build & Installation Completed." echo "Build & Installation Completed."

18
run.sh
View File

@ -2,7 +2,7 @@
# Exit if we're debugging and haven't yet built the gateway # Exit if we're debugging and haven't yet built the gateway
if [ ! -f "/opt/ttn-gateway/dev/packet_forwarder/mp_pkt_fwd/mp_pkt_fwd" ]; then if [ ! -f "mp_pkt_fwd" ]; then
echo "ERROR: gateway executable not yet built" echo "ERROR: gateway executable not yet built"
exit 1 exit 1
fi fi
@ -157,12 +157,18 @@ echo -e "{\n\
\t}\n\ \t}\n\
}" >./local_conf.json }" >./local_conf.json
# Set gateway_ID in local_conf.json to the gateway's MAC address
#echo "******************" echo "******************"
#./set-gateway-id.sh start ./local_conf.json # get gateway ID from its MAC address
#echo "******************" GWID_PREFIX="FFFE"
#echo "" GWID=$(ip link show eth0 | awk '/ether/ {print $2}' | awk -F\: '{print $1$2$3$4$5$6}')
# replace last 8 digits of default gateway ID by actual GWID, in given JSON configuration file
sed -i 's/\(^\s*"gateway_ID":\s*"\).\{16\}"\s*\(,\?\).*$/\1'${GWID_PREFIX}${GWID}'"\2/' local_conf.json
echo "Gateway_ID set to "$GWID_PREFIX$GWID" "
echo "******************"
echo ""
# Fire up the forwarder. # Fire up the forwarder.