gluon-radvd: replace pregenerated config file with Lua script

This commit is contained in:
Matthias Schiffer 2014-05-14 14:22:06 +02:00
parent 41dbaed19e
commit ee829e8c90
4 changed files with 23 additions and 14 deletions

View File

@ -1,8 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-radvd PKG_NAME:=gluon-radvd
PKG_VERSION:=1 PKG_VERSION:=2
PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION)
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
@ -31,7 +30,6 @@ endef
define Package/gluon-radvd/install define Package/gluon-radvd/install
$(CP) ./files/* $(1)/ $(CP) ./files/* $(1)/
$(GLUON_GENERATE) ./generate/* $(1)/
endef endef
$(eval $(call BuildPackage,gluon-radvd)) $(eval $(call BuildPackage,gluon-radvd))

View File

@ -7,12 +7,19 @@ SERVICE_NAME=gluon-radvd
SERVICE_PID_DIR=/var/run/gluon-radvd SERVICE_PID_DIR=/var/run/gluon-radvd
SERVICE_PID_FILE="$SERVICE_PID_DIR"/gluon-radvd.pid SERVICE_PID_FILE="$SERVICE_PID_DIR"/gluon-radvd.pid
radvd_conf=/var/gluon/radvd/radvd.conf
start() { start() {
mkdir -p "$SERVICE_PID_DIR" mkdir -p "$SERVICE_PID_DIR"
chown gluon-radvd "$SERVICE_PID_DIR" chown gluon-radvd "$SERVICE_PID_DIR"
service_start /usr/sbin/radvd -C /lib/gluon/radvd/radvd.conf -m stderr_syslog -u gluon-radvd -p "$SERVICE_PID_FILE"
mkdir -p "$(dirname "$radvd_conf")"
/lib/gluon/radvd/generate_config > "$radvd_conf"
service_start /usr/sbin/radvd -C "$radvd_conf" -m stderr_syslog -u gluon-radvd -p "$SERVICE_PID_FILE"
} }
stop() { stop() {
service_stop /usr/sbin/radvd service_stop /usr/sbin/radvd
rm "$radvd_conf"
} }

View File

@ -0,0 +1,14 @@
#!/usr/bin/lua
local site = require 'gluon.site_config'
print([[
interface br-client
{
IgnoreIfMissing on;
AdvSendAdvert on;
AdvDefaultLifetime 0;
prefix ]] .. site.prefix6 .. [[ {};
};
]])

View File

@ -1,10 +0,0 @@
interface br-client
{
IgnoreIfMissing on;
AdvSendAdvert on;
AdvDefaultLifetime 0;
prefix @prefix6@
{
};
};