From cb6e5ce35bd3bd955ec86bb87a38055f3bc04018 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Wed, 24 Aug 2016 12:39:32 +0200 Subject: [PATCH] package: add luci-app-freewtp --- openwrt/luci-app-freewtp/Makefile | 39 +++++++++++ .../luasrc/controller/freewtp.lua | 13 ++++ .../luasrc/model/cbi/freewtp/freewtp.lua | 67 +++++++++++++++++++ 3 files changed, 119 insertions(+) create mode 100644 openwrt/luci-app-freewtp/Makefile create mode 100644 openwrt/luci-app-freewtp/luasrc/controller/freewtp.lua create mode 100644 openwrt/luci-app-freewtp/luasrc/model/cbi/freewtp/freewtp.lua diff --git a/openwrt/luci-app-freewtp/Makefile b/openwrt/luci-app-freewtp/Makefile new file mode 100644 index 0000000..5dec6af --- /dev/null +++ b/openwrt/luci-app-freewtp/Makefile @@ -0,0 +1,39 @@ +# +# Copyright (C) 2016 Travelping GmbH +# +# This is free software, licensed under the Apache License, Version 2.0 . +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-freewtp +PKG_VERSION:=1.0 +PKG_RELEASE:=1 + +PKG_LICENSE:=Apache-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-freewtp + SECTION:=luci + CATEGORY:=LuCI + SUBMENU:=3. Applications + TITLE:=FreeWTP CAPWAP WTP + URL:=https://github.com/travelping/freewtp + MAINTAINER:=Travelping GmbH + DEPENDS:=+freewtp +luci-base +endef + +define Package/luci-app-freewtp/description + This package allows you to configure the FreeWTP CAPWAP WTP +endef + +define Build/Compile +endef + +define Package/luci-app-freewtp/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci + $(CP) ./luasrc/* $(1)/usr/lib/lua/luci +endef + +$(eval $(call BuildPackage,luci-app-freewtp)) diff --git a/openwrt/luci-app-freewtp/luasrc/controller/freewtp.lua b/openwrt/luci-app-freewtp/luasrc/controller/freewtp.lua new file mode 100644 index 0000000..5a2d5f1 --- /dev/null +++ b/openwrt/luci-app-freewtp/luasrc/controller/freewtp.lua @@ -0,0 +1,13 @@ +-- Copyright 2008 Steven Barth +-- Copyright 2010-2015 Jo-Philipp Wich +-- Licensed to the public under the Apache License 2.0. + +module("luci.controller.freewtp", package.seeall) + +function index() + if not nixio.fs.access("/etc/config/wtp") then + return + end + + entry( {"admin", "services", "freewtp"}, cbi("freewtp/freewtp"), _("FreeWTP"), 90).leaf=true +end diff --git a/openwrt/luci-app-freewtp/luasrc/model/cbi/freewtp/freewtp.lua b/openwrt/luci-app-freewtp/luasrc/model/cbi/freewtp/freewtp.lua new file mode 100644 index 0000000..e6e0388 --- /dev/null +++ b/openwrt/luci-app-freewtp/luasrc/model/cbi/freewtp/freewtp.lua @@ -0,0 +1,67 @@ +-- Copyright 2008 Steven Barth +-- Copyright 2010-2015 Jo-Philipp Wich +-- Licensed to the public under the Apache License 2.0. + +m = Map("wtp", translate("FreeWTP"), + translate("FreeWTP CAPWAP WTP")) + +s = m:section(TypedSection, "wtp", nil, translate("Settings")) +s.addremove = false +s.anonymous = true + +s:tab("general", translate("General Settings")) +s:tab("ac", translate("Access Controller")) +s:tab("security", translate("Security")) + +name = s:taboption("general", Value, "name", translate("Name"), + translate("Name of the WTP instance.")) +name.datatype = "string" + +uuid = s:taboption("general", Value, "uuid", translate("ID"), + translate("Unique Identifier")) +uuid.datatype = "string" +uuid.readonly = true + +country = s:taboption("general", Value, "country", translate("Country"), + translate("ISO/IEC 3166 alpha2 country code")) +country.datatype = "string" + +location = s:taboption("general", Value, "location", translate("Location"), + translate("Geographic location")) +location.datatype = "string" + +ac = s:taboption("ac", Value, "host", translate("Access Controller"), + translate("Hostname of the Access Controller")) +location.datatype = "hostname" + +encr = s:taboption("security", ListValue, "dtlsmode", translate("DTLS Security Mode")) +encr:value("off", translate("Disabled")) +encr:value("psk", translate("Pre-shared Key")) +encr:value("x509", translate("X.509")) + +ident = s:taboption("security", Value, "identifier", translate("Identifier"), + translate("Identifier")) +ident:depends("dtlsmode", "psk") +ident.datatype = "string" +ident.rmempty = true + +psk = s:taboption("security", Value, "psk", translate("Pre-shared Key"), + translate("Passphrase")) +psk:depends("dtlsmode", "psk") +psk.datatype = "string" +psk.rmempty = true +psk.password = true + +ca = s:taboption("security", FileUpload, "ca", translate("Certification Authority File")) +ca:depends("dtlsmode", "x509") +ca.rmempty = true + +cert = s:taboption("security", FileUpload, "cert", translate("Certificate File")) +cert:depends("dtlsmode", "x509") +cert.rmempty = true + +key = s:taboption("security", FileUpload, "key", translate("Private Key File")) +key:depends("dtlsmode", "x509") +key.rmempty = true + +return m