From 185d57f4585da30257407e82317a5f577dd5e9fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kr=C3=BCger?= Date: Thu, 7 Apr 2022 16:49:31 +0200 Subject: [PATCH] private-ap: init --- package/gluon-private-ap/Makefile | 12 ++++++++++++ .../lib/gluon/upgrade/325-gluon-private-ap | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 package/gluon-private-ap/Makefile create mode 100755 package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap diff --git a/package/gluon-private-ap/Makefile b/package/gluon-private-ap/Makefile new file mode 100644 index 00000000..2df31c98 --- /dev/null +++ b/package/gluon-private-ap/Makefile @@ -0,0 +1,12 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-private-ap + +include ../gluon.mk + +define Package/gluon-private-ap + TITLE:=Provides a virtual access point for the nodes client network + DEPENDS:=+gluon-core +endef + +$(eval $(call BuildPackageGluon,gluon-private-ap)) diff --git a/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap b/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap new file mode 100755 index 00000000..0a4a4eed --- /dev/null +++ b/package/gluon-private-ap/luasrc/lib/gluon/upgrade/325-gluon-private-ap @@ -0,0 +1,18 @@ +#!/usr/bin/lua + +local uci = require("simple-uci").cursor() +local wireless = require 'gluon.wireless' + +wireless.foreach_radio(uci, function(radio) + local radio_name = radio['.name'] + local suffix = radio_name:match('^radio(%d+)$') + local name = "ap_" .. radio_name + + if not uci:get('wireless', name, 'device') then + return + end + + uci:set('wireless', name, 'ifname', suffix and 'wan' .. suffix) +end) + +uci:save('wireless')