gluon-mesh-vpn-tunneldigger: add package for tunneldigger L2TP support

This commit is contained in:
Cyrus Fox 2017-03-10 03:22:41 +01:00 committed by Matthias Schiffer
parent be88eba07f
commit ad7a36fdce
No known key found for this signature in database
GPG Key ID: 16EF3F64CB201D9C
4 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,38 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-vpn-tunneldigger
PKG_VERSION:=3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
include ../gluon.mk
define Package/gluon-mesh-vpn-tunneldigger
SECTION:=gluon
CATEGORY:=Gluon
TITLE:=Support for connecting meshes via tunneltigger/L2TPv3 pseudowire
DEPENDS:=+gluon-core +gluon-mesh-vpn-core +tunneldigger
endef
define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef
define Build/Configure
endef
define Build/Compile
$(call GluonSrcDiet,./luasrc,$(PKG_BUILD_DIR)/luadest/)
endef
define Package/gluon-mesh-vpn-tunneldigger/install
$(CP) ./files/* $(1)/
$(CP) $(PKG_BUILD_DIR)/luadest/* $(1)/
endef
define Package/gluon-mesh-vpn-tunneldigger/postinst
#!/bin/sh
$(call GluonCheckSite,check_site.lua)
endef
$(eval $(call BuildPackage,gluon-mesh-vpn-tunneldigger))

View File

@ -0,0 +1 @@
need_string_array('mesh_vpn.tunneldigger.brokers')

View File

@ -0,0 +1,32 @@
#!/usr/bin/lua
local site = require 'gluon.site_config'
local util = require 'gluon.util'
local uci = require('simple-uci').cursor()
local enabled = uci:get('tunneldigger', 'mesh_vpn', 'enabled')
if enabled == nil then
enabled = uci:get_first('tunneldigger', 'broker', 'enabled')
end
if enabled == nil then
enabled = site.mesh_vpn.enabled or false
end
-- Delete old broker config section
if not uci:get('tunneldigger', 'mesh_vpn') then
uci:delete_all('tunneldigger', 'broker')
end
uci:section('tunneldigger', 'broker', 'mesh_vpn', {
enabled = enabled,
uuid = util.node_id(),
interface = 'mesh-vpn',
bind_interface = 'br-wan',
group = 'gluon-mesh-vpn',
broker_selection = 'usage',
address = site.mesh_vpn.tunneldigger.brokers,
})
uci:save('tunneldigger')