From fdf19830d7d39a5b66e6b8c1657f5cc6c3fc6760 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 30 Sep 2013 21:29:52 +0200 Subject: [PATCH] gluon-mesh-vpn-fastd: generate fastd config from site configuration --- package/gluon-mesh-vpn-fastd/Makefile | 4 +- package/gluon-mesh-vpn-fastd/fastd.pl | 59 +++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 package/gluon-mesh-vpn-fastd/fastd.pl diff --git a/package/gluon-mesh-vpn-fastd/Makefile b/package/gluon-mesh-vpn-fastd/Makefile index 777cb024..d2322682 100644 --- a/package/gluon-mesh-vpn-fastd/Makefile +++ b/package/gluon-mesh-vpn-fastd/Makefile @@ -27,10 +27,12 @@ define Build/Configure endef define Build/Compile + $(GLUON_CONFIGURE) fastd.pl > $(PKG_BUILD_DIR)/fastd.sh endef define Package/gluon-mesh-vpn-fastd/install - $(CP) ./files/* $(1)/ + $(INSTALL_DIR) $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant + $(INSTALL_BIN) $(PKG_BUILD_DIR)/fastd.sh $(1)/lib/gluon/upgrade/mesh-vpn-fastd/invariant/010-mesh-vpn-fastd endef $(eval $(call BuildPackage,gluon-mesh-vpn-fastd)) diff --git a/package/gluon-mesh-vpn-fastd/fastd.pl b/package/gluon-mesh-vpn-fastd/fastd.pl new file mode 100644 index 00000000..85bc7e28 --- /dev/null +++ b/package/gluon-mesh-vpn-fastd/fastd.pl @@ -0,0 +1,59 @@ +my $cfg = $CONFIG->{fastd_mesh_vpn}; +my $backbone = $cfg->{backbone}; + +my $add_methods = ''; +for (@{$cfg->{methods}}) { + $add_methods .= "add_list fastd.mesh_vpn.method='$_'\n"; +} + +my $set_peer_limit; +if ($backbone->{limit}) { + $set_peer_limit = "set fastd.mesh_vpn_backbone.peer_limit='$backbone->{limit}'\n"; +} +else { + $set_peer_limit = "delete fastd.mesh_vpn_backbone.peer_limit\n"; +} + +print <{peers}}) { + my $peer = $backbone->{peers}->{$name}; + print <{remotes}}) { + print "add_list fastd.mesh_vpn_backbone_peer_$name.remote='$_'\n"; + } +} + +print <