From fbd8159eec0bbeb8a819d9da81268b9006bd3a7b Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Wed, 12 Oct 2016 12:03:46 -0500 Subject: lora-pkt-fwd: add init file and set iot.semtech.com as default server --- .../lora/lora-network-server-mtp/local_conf.json | 7 +++ .../lora-network-server.default | 2 +- .../lora/lora-network-server-mtp_1.0.13.bb | 4 +- .../lora/lora-packet-forwarder/local_conf.json | 7 +++ .../lora-packet-forwarder/local_conf.json.3.0.0 | 7 --- .../lora-packet-forwarder.default | 2 + .../lora-packet-forwarder.init | 62 ++++++++++++++++++++++ .../lora/lora-packet-forwarder_3.0.0.bb | 13 +++-- 8 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 recipes-connectivity/lora/lora-network-server-mtp/local_conf.json create mode 100644 recipes-connectivity/lora/lora-packet-forwarder/local_conf.json delete mode 100644 recipes-connectivity/lora/lora-packet-forwarder/local_conf.json.3.0.0 create mode 100644 recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default create mode 100755 recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init (limited to 'recipes-connectivity/lora') diff --git a/recipes-connectivity/lora/lora-network-server-mtp/local_conf.json b/recipes-connectivity/lora/lora-network-server-mtp/local_conf.json new file mode 100644 index 0000000..3c2af80 --- /dev/null +++ b/recipes-connectivity/lora/lora-network-server-mtp/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "localhost", + "serv_port_up": 1780, + "serv_port_down": 1782 + } +} diff --git a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default index be7dcd5..0f92640 100644 --- a/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default +++ b/recipes-connectivity/lora/lora-network-server-mtp/lora-network-server.default @@ -1,2 +1,2 @@ # set to "yes" or "no" to control starting on boot -ENABLED="yes" +ENABLED="no" diff --git a/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb b/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb index 4714090..898e2ec 100644 --- a/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb +++ b/recipes-connectivity/lora/lora-network-server-mtp_1.0.13.bb @@ -7,12 +7,13 @@ LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://LICENSE;md5=7ffae4666a986c4ccf45e99e464f8402" DEPENDS = "jsoncpp libmts mosquitto sqlite3" RDEPENDS_${PN} += "lora-packet-forwarder logrotate" -PR = "r0" +PR = "r1" SRC_URI = "http://multitech.net/downloads/lora-network-server_${TUNE_PKGARCH}_${PV}-mtp.tar.gz \ file://lora-network-server.init \ file://lora-network-server.default \ file://lora-network-server.logrotate.conf \ + file://local_conf.json \ " SRC_URI[md5sum] = "d21cab149a81938da7728f38d0baa3e4" @@ -32,6 +33,7 @@ do_install() { install -d ${D}${LORA_DIR} install -m 0755 lora-network-server ${D}${LORA_DIR}/ install -m 0644 lora-network-server.conf ${D}${LORA_DIR}/ + install -m 0755 ${WORKDIR}/local_conf.json ${D}${LORA_DIR}/ install -d ${D}${sysconfdir}/default install -m 0644 ${WORKDIR}/lora-network-server.default ${D}${sysconfdir}/default/lora-network-server diff --git a/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json new file mode 100644 index 0000000..6576072 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json @@ -0,0 +1,7 @@ +{ + "gateway_conf": { + "server_address": "iot.semtech.com", + "serv_port_up": 1680, + "serv_port_down": 1680 + } +} diff --git a/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json.3.0.0 b/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json.3.0.0 deleted file mode 100644 index 3c2af80..0000000 --- a/recipes-connectivity/lora/lora-packet-forwarder/local_conf.json.3.0.0 +++ /dev/null @@ -1,7 +0,0 @@ -{ - "gateway_conf": { - "server_address": "localhost", - "serv_port_up": 1780, - "serv_port_down": 1782 - } -} diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default new file mode 100644 index 0000000..0f92640 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.default @@ -0,0 +1,2 @@ +# set to "yes" or "no" to control starting on boot +ENABLED="no" diff --git a/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init new file mode 100755 index 0000000..5fec143 --- /dev/null +++ b/recipes-connectivity/lora/lora-packet-forwarder/lora-packet-forwarder.init @@ -0,0 +1,62 @@ +#!/bin/bash + +NAME="lora-packet-forwarder" +ENABLED="yes" + +START_STOP_DAEMON="/usr/sbin/start-stop-daemon" + +[ -f /etc/default/$NAME ] && source /etc/default/$NAME + +run_dir=/var/run/lora +pkt_fwd=/opt/lora/lora_pkt_fwd +pkt_fwd_pidfile=$run_dir/lora-pkt-fwd-1.pid +log_file=/var/log/lora-pkt-fwd.log + +do_start() { + echo -n "Starting $NAME: " + + mkdir -p $run_dir + + # start packet forwarder + $START_STOP_DAEMON --start --background --make-pidfile \ + --pidfile $pkt_fwd_pidfile --startas /bin/bash --chdir "/opt/lora/" \ + -- -c "exec $pkt_fwd > $log_file 2>&1" + + renice -n -20 -p $(pgrep $(basename $pkt_fwd)) + + echo "OK" +} + +do_stop() { + echo -n "Stopping $NAME: " + $START_STOP_DAEMON --stop --quiet --oknodo --pidfile $pkt_fwd_pidfile --retry 5 + rm -f $pkt_fwd_pidfile + echo "OK" +} + +if [ "$ENABLED" != "yes" ]; then + echo "$NAME: disabled in /etc/default" + exit +fi + +case "$1" in + "start") + do_start + ;; + "stop") + do_stop + ;; + "restart") + ## Stop the service and regardless of whether it was + ## running or not, start it again. + do_stop + do_start + ;; + *) + ## If no parameters are given, print which are avaiable. + echo "Usage: $0 {start|stop|restart}" + exit 1 + ;; +esac + + diff --git a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb index c1f8be6..4c23e1c 100644 --- a/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb +++ b/recipes-connectivity/lora/lora-packet-forwarder_3.0.0.bb @@ -6,15 +6,17 @@ SECTION = "console/utils" LICENSE = "SEMTECH" LIC_FILES_CHKSUM = "file://LICENSE;md5=22af7693d7b76ef0fc76161c4be76c45" DEPENDS = "lora-gateway" -PR = "r2" +PR = "r3" SRCREV = "v${PV}" SRC_URI = "git://github.com/Lora-net/packet_forwarder.git;protocol=git \ file://README.md \ + file://lora-packet-forwarder.init \ + file://lora-packet-forwarder.default \ file://global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc0 \ file://global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 \ - file://local_conf.json.3.0.0 \ + file://local_conf.json \ " S = "${WORKDIR}/git" @@ -35,7 +37,12 @@ do_install() { install -m 755 lora_pkt_fwd/lora_pkt_fwd ${D}${LORA_DIR}/ # This file may be overwritten with a do_install_append_ function install -m 755 ${WORKDIR}/global_conf.json.3.0.0.PCB_E286.EU868.basic.clksrc1 ${D}${LORA_DIR}/global_conf.json - install -m 755 ${WORKDIR}/local_conf.json.3.0.0 ${D}${LORA_DIR}/local_conf.json + install -m 755 ${WORKDIR}/local_conf.json ${D}${LORA_DIR}/ + + install -d ${D}${sysconfdir}/default + install -m 0644 ${WORKDIR}/lora-packet-forwarder.default ${D}${sysconfdir}/default/lora-packet-forwarder + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/lora-packet-forwarder.init ${D}${sysconfdir}/init.d/lora-packet-forwarder install -m 755 util_sink/util_sink ${D}${LORA_DIR}/ install -m 755 util_ack/util_ack ${D}${LORA_DIR}/ -- cgit v1.2.3