split gluon-radvd into gluon-radvd-babel and gluon-radvd-batman, make mkconfig for gluon-mesh-babel more flexible

This commit is contained in:
Christof Schulze 2016-04-27 23:36:08 +02:00
parent 6a7afebecc
commit 2a68763ad0
11 changed files with 109 additions and 5 deletions

View File

@ -0,0 +1,37 @@
#!/bin/sh /etc/rc.common
. $IPKG_INSTROOT/lib/functions/network.sh
START=70
pidfile='/var/run/babeld.pid'
CONFIGFILE='/var/etc/gluon-babel.conf'
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Dump Babel's table to the log file."
start() {
mkdir -p /var/lib
mkdir -p /var/etc
/lib/gluon/gluon-mesh-babel/mkconfig "$CONFIGFILE"
/usr/sbin/babeld -D -I "$pidfile" -c "$CONFIGFILE"
# Wait for the pidfile to appear
for i in 1 2
do
[ -f "$pidfile" ] || sleep 1
done
[ -f "$pidfile" ] || (echo "Failed to start babeld"; exit 42)
}
stop() {
[ -f "$pidfile" ] && kill $(cat $pidfile)
# avoid race-condition on restart: wait for
# babeld to die for real.
[ -f "$pidfile" ] && sleep 1
[ -f "$pidfile" ] && sleep 1
[ -f "$pidfile" ] && sleep 1
[ -f "$pidfile" ] && exit 42
}
status() {
[ -f "$pidfile" ] && kill -USR1 $(cat $pidfile)
}

View File

@ -1,20 +1,20 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-radvd
PKG_NAME:=gluon-radvd-babel
PKG_VERSION:=4
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/gluon-radvd
define Package/gluon-radvd-babel
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Advertise an IPv6 prefix from the node
DEPENDS:=+gluon-core +uradvd
endef
define Package/gluon-radvd/description
define Package/gluon-radvd-babel/description
Gluon community wifi mesh firmware framework: Advertise an IPv6 prefix from the node
endef
@ -28,8 +28,8 @@ endef
define Build/Compile
endef
define Package/gluon-radvd/install
define Package/gluon-radvd-babel/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,gluon-radvd))
$(eval $(call BuildPackage,gluon-radvd-babel))

View File

@ -0,0 +1,15 @@
#!/bin/sh /etc/rc.common
START=50
SERVICE_WRITE_PID=1
SERVICE_DAEMONIZE=1
start() {
service_start /usr/sbin/uradvd -i local-node -a $(lua -e 'print(require("gluon.site_config").prefix6)') --default-lifetime 900
}
stop() {
service_stop /usr/sbin/uradvd
}

View File

@ -0,0 +1,35 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-radvd-batman
PKG_VERSION:=4
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include $(INCLUDE_DIR)/package.mk
define Package/gluon-radvd-batman
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Advertise an IPv6 prefix from the node
DEPENDS:=+gluon-core +uradvd
endef
define Package/gluon-radvd-batman/description
Gluon community wifi mesh firmware framework: Advertise an IPv6 prefix from the node
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/gluon-radvd-batman/install
$(CP) ./files/* $(1)/
endef
$(eval $(call BuildPackage,gluon-radvd-batman))

View File

@ -0,0 +1,5 @@
#!/usr/bin/lua
local users = require 'gluon.users'
users.remove_user('gluon-radvd')

View File

@ -0,0 +1,6 @@
#!/bin/sh
. /lib/gluon/autoupdater/lib.sh
start_enabled gluon-radvd

View File

@ -0,0 +1,6 @@
#!/bin/sh
. /lib/gluon/autoupdater/lib.sh
stop gluon-radvd