Skip to content

Commit 1567e07

Browse files
committed
Implement Dragino LG308 ipk packaging.
1 parent b9749fc commit 1567e07

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh /etc/rc.common
2+
3+
START=100
4+
STOP=100
5+
6+
NAME="chirpstack-gateway-bridge"
7+
DAEMON_BIN=/opt/$NAME/$NAME
8+
DAEMON_CONF=/etc/$NAME/$NAME.toml
9+
DAEMON_PID=/var/run/$NAME.pid
10+
11+
start() {
12+
echo "Starting $NAME"
13+
start-stop-daemon \
14+
-S \
15+
-b \
16+
-m \
17+
-p $DAEMON_PID \
18+
-x $DAEMON_BIN -- --config $DAEMON_CONF
19+
}
20+
21+
stop() {
22+
echo "Stopping $NAME"
23+
start-stop-daemon \
24+
-K \
25+
-p $DAEMON_PID
26+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This configuration provides a Semtech UDP packet-forwarder backend and
2+
# integrates with a MQTT broker. Many options and defaults have been omitted
3+
# for simplicity.
4+
#
5+
# See https://www.chirpstack.io/gateway-bridge/install/config/ for a full
6+
# configuration example and documentation.
7+
8+
9+
# Gateway backend configuration.
10+
[backend]
11+
# Backend type.
12+
type="semtech_udp"
13+
14+
# Semtech UDP packet-forwarder backend.
15+
[backend.semtech_udp]
16+
17+
# ip:port to bind the UDP listener to
18+
#
19+
# Example: 0.0.0.0:1700 to listen on port 1700 for all network interfaces.
20+
# This is the listener to which the packet-forwarder forwards its data
21+
# so make sure the 'serv_port_up' and 'serv_port_down' from your
22+
# packet-forwarder matches this port.
23+
udp_bind = "0.0.0.0:1700"
24+
25+
26+
# Integration configuration.
27+
[integration]
28+
# Payload marshaler.
29+
#
30+
# This defines how the MQTT payloads are encoded. Valid options are:
31+
# * protobuf: Protobuf encoding
32+
# * json: JSON encoding (easier for debugging, but less compact than 'protobuf')
33+
marshaler="protobuf"
34+
35+
# MQTT integration configuration.
36+
[integration.mqtt]
37+
# Event topic template.
38+
event_topic_template="gateway/{{ .GatewayID }}/event/{{ .EventType }}"
39+
40+
# Command topic template.
41+
command_topic_template="gateway/{{ .GatewayID }}/command/#"
42+
43+
# MQTT authentication.
44+
[integration.mqtt.auth]
45+
# Type defines the MQTT authentication type to use.
46+
#
47+
# Set this to the name of one of the sections below.
48+
type="generic"
49+
50+
# Generic MQTT authentication.
51+
[integration.mqtt.auth.generic]
52+
# MQTT server (e.g. scheme://host:port where scheme is tcp, ssl or ws)
53+
server="tcp://127.0.0.1:1883"
54+
55+
# Connect with the given username (optional)
56+
username=""
57+
58+
# Connect with the given password (optional)
59+
password=""
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/env bash
2+
3+
PACKAGE_NAME="chirpstack-gateway-bridge"
4+
PACKAGE_VERSION=$1
5+
REV="r1"
6+
7+
8+
PACKAGE_URL="https://artifacts.chirpstack.io/downloads/chirpstack-gateway-bridge/chirpstack-gateway-bridge_${PACKAGE_VERSION}_linux_mips.tar.gz"
9+
DIR=`dirname $0`
10+
PACKAGE_DIR="${DIR}/package"
11+
12+
# Cleanup
13+
rm -rf $PACKAGE_DIR
14+
15+
# CONTROL
16+
mkdir -p $PACKAGE_DIR/CONTROL
17+
cat > $PACKAGE_DIR/CONTROL/control << EOF
18+
Package: $PACKAGE_NAME
19+
Version: $PACKAGE_VERSION-$REV
20+
Architecture: mips_24kc
21+
Maintainer: Orne Brocaar <info@brocaar.com>
22+
Priority: optional
23+
Section: network
24+
Source: N/A
25+
Description: ChirpStack Gateway Bridge
26+
EOF
27+
28+
cat > $PACKAGE_DIR/CONTROL/postinst << EOF
29+
#!/bin/sh
30+
/etc/init.d/chirpstack-gateway-bridge enable
31+
EOF
32+
chmod 755 $PACKAGE_DIR/CONTROL/postinst
33+
34+
cat > $PACKAGE_DIR/CONTROL/conffiles << EOF
35+
/etc/$PACKAGE_NAME/$PACKAGE_NAME.toml
36+
EOF
37+
38+
# Files
39+
mkdir -p $PACKAGE_DIR/opt/$PACKAGE_NAME
40+
mkdir -p $PACKAGE_DIR/etc/$PACKAGE_NAME
41+
mkdir -p $PACKAGE_DIR/etc/init.d
42+
43+
cp files/$PACKAGE_NAME.toml $PACKAGE_DIR/etc/$PACKAGE_NAME/$PACKAGE_NAME.toml
44+
cp files/$PACKAGE_NAME.init $PACKAGE_DIR/etc/init.d/$PACKAGE_NAME
45+
wget -P $PACKAGE_DIR/opt/$PACKAGE_NAME $PACKAGE_URL
46+
tar zxf $PACKAGE_DIR/opt/$PACKAGE_NAME/*.tar.gz -C $PACKAGE_DIR/opt/$PACKAGE_NAME
47+
rm $PACKAGE_DIR/opt/$PACKAGE_NAME/*.tar.gz
48+
49+
# Package
50+
opkg-build -c -o root -g root $PACKAGE_DIR
51+
52+
# Cleanup
53+
rm -rf $PACKAGE_DIR

0 commit comments

Comments
 (0)