From 4e19df098a839cd0ccf20d86d39a12dc865c66c5 Mon Sep 17 00:00:00 2001
From: Nils Schneider <nils@nilsschneider.net>
Date: Wed, 3 Sep 2014 20:37:17 +0200
Subject: [PATCH] mesh-vpn-fastd: enable from site.conf

This patch allows fastd's enabled flag's default value to be set from
site.conf.
---
 package/gluon-mesh-vpn-fastd/check_site.lua        |  1 +
 .../mesh-vpn-fastd/initial/010-mesh-vpn-fastd      | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
 create mode 100755 package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/initial/010-mesh-vpn-fastd

diff --git a/package/gluon-mesh-vpn-fastd/check_site.lua b/package/gluon-mesh-vpn-fastd/check_site.lua
index 6c817137b..fc9d8221d 100644
--- a/package/gluon-mesh-vpn-fastd/check_site.lua
+++ b/package/gluon-mesh-vpn-fastd/check_site.lua
@@ -11,3 +11,4 @@ local function check_peer(k, _)
 end
 
 need_table('fastd_mesh_vpn.backbone.peers', check_peer)
+need_boolean('fastd_mesh_vpn.enabled', false)
diff --git a/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/initial/010-mesh-vpn-fastd b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/initial/010-mesh-vpn-fastd
new file mode 100755
index 000000000..4beb71460
--- /dev/null
+++ b/package/gluon-mesh-vpn-fastd/files/lib/gluon/upgrade/mesh-vpn-fastd/initial/010-mesh-vpn-fastd
@@ -0,0 +1,14 @@
+#!/usr/bin/lua
+
+local site = require 'gluon.site_config'
+local uci = require 'luci.model.uci'
+local c = uci.cursor()
+
+c:section('fastd', 'fastd', 'mesh_vpn',
+	  {
+		  enabled = site.fastd_mesh_vpn.enabled and 1 or 0
+	  }
+)
+
+c:save('fastd')
+c:commit('fastd')
-- 
GitLab