aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-09-16 22:02:28 +0200
committerFelix Fietkau <nbd@nbd.name>2022-09-16 22:02:28 +0200
commit2b1e651178b7731729b73786d44bc4c3b5bbad14 (patch)
treec31ee4b3ed66dd20372847d73db7d7c8124ee18d
parent51c727e2688ee8b1b8920f9dcfa1f746c93c9183 (diff)
downloadupstream-2b1e651178b7731729b73786d44bc4c3b5bbad14.tar.gz
upstream-2b1e651178b7731729b73786d44bc4c3b5bbad14.tar.bz2
upstream-2b1e651178b7731729b73786d44bc4c3b5bbad14.zip
unetd: add missing init script
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--package/network/services/unetd/files/unet-dht.init24
1 files changed, 24 insertions, 0 deletions
diff --git a/package/network/services/unetd/files/unet-dht.init b/package/network/services/unetd/files/unet-dht.init
new file mode 100644
index 0000000000..272626a933
--- /dev/null
+++ b/package/network/services/unetd/files/unet-dht.init
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Copyright (c) 2022 OpenWrt.org
+
+START=19
+
+USE_PROCD=1
+PROG=/usr/sbin/unet-dht
+
+unet_dht_id() {
+ cat \
+ /sys/class/net/eth?/address \
+ /sys/class/ieee80211/phy*/macaddress \
+ /etc/board.json | md5sum | awk '{ print $1 }'
+}
+
+start_service() {
+ mkdir -p /var/run/unetd /etc/unetd
+
+ procd_open_instance
+ procd_set_param command "$PROG" -u /var/run/unetd/socket -n /var/run/unetd/nodes.dat $(unet_dht_id)
+ procd_set_param respawn
+ procd_set_param limits core="unlimited"
+ procd_close_instance
+}