Skip to content

Commit 42f16d4

Browse files
committed
Implement .ipk script for Multitech Conduit gateway.
1 parent ccead81 commit 42f16d4

File tree

2 files changed

+94
-0
lines changed

2 files changed

+94
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
NAME="lora-gateway-bridge"
2+
DESC="LoRa Gateway Bridge"
3+
DAEMON_BIN=/opt/$NAME/$NAME
4+
DAEMON_CONF=/etc/$NAME
5+
DAEMON_PID=/var/run/$NAME.pid
6+
7+
function do_start {
8+
echo "Starting $NAME"
9+
start-stop-daemon \
10+
--start \
11+
--background \
12+
--make-pidfile \
13+
--pidfile $DAEMON_PID \
14+
--exec $DAEMON_BIN -- --config /var/config/$NAME/$NAME.toml
15+
}
16+
17+
function do_stop {
18+
echo "Stopping $NAME"
19+
start-stop-daemon \
20+
--stop \
21+
--oknodo \
22+
--quiet \
23+
--pidfile $DAEMON_PID
24+
}
25+
26+
case "$1" in
27+
"start")
28+
do_start
29+
;;
30+
"stop")
31+
do_stop
32+
;;
33+
"restart")
34+
do_stop
35+
do_start
36+
;;
37+
*)
38+
echo "Usage: $1 {start|stop|restart}"
39+
exit 1
40+
;;
41+
esac
42+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/env bash
2+
3+
PACKAGE_NAME="lora-gateway-bridge"
4+
PACKAGE_VERSION="2.7.0"
5+
REV="r2"
6+
7+
8+
PACKAGE_URL="https://artifacts.loraserver.io/downloads/lora-gateway-bridge/lora-gateway-bridge_${PACKAGE_VERSION}_linux_armv5.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: arm926ejste
21+
Maintainer: Orne Brocaar <info@brocaar.com>
22+
Priority: optional
23+
Section: network
24+
Source: N/A
25+
Description: LoRa Gateway Bridge
26+
EOF
27+
28+
cat > $PACKAGE_DIR/CONTROL/postinst << EOF
29+
update-rc.d lora-gateway-bridge defaults
30+
EOF
31+
chmod 755 $PACKAGE_DIR/CONTROL/postinst
32+
33+
cat > $PACKAGE_DIR/CONTROL/conffiles << EOF
34+
/var/config/$PACKAGE_NAME/$PACKAGE_NAME.toml
35+
EOF
36+
37+
# Files
38+
mkdir -p $PACKAGE_DIR/opt/$PACKAGE_NAME
39+
mkdir -p $PACKAGE_DIR/var/config/$PACKAGE_NAME
40+
mkdir -p $PACKAGE_DIR/etc/init.d
41+
42+
cp files/$PACKAGE_NAME.toml $PACKAGE_DIR/var/config/$PACKAGE_NAME/$PACKAGE_NAME.toml
43+
cp files/$PACKAGE_NAME.init $PACKAGE_DIR/etc/init.d/$PACKAGE_NAME
44+
wget -P $PACKAGE_DIR/opt/$PACKAGE_NAME $PACKAGE_URL
45+
tar zxf $PACKAGE_DIR/opt/$PACKAGE_NAME/*.tar.gz -C $PACKAGE_DIR/opt/$PACKAGE_NAME
46+
rm $PACKAGE_DIR/opt/$PACKAGE_NAME/*.tar.gz
47+
48+
# Package
49+
opkg-build -o root -g root $PACKAGE_DIR
50+
51+
# Cleanup
52+
rm -rf $PACKAGE_DIR

0 commit comments

Comments
 (0)