From e729b8131282fb19358a84068ddd79cc57785b68 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 1 May 2021 21:27:12 +0200 Subject: [PATCH] gluon-private-wifi: add package Add a package for handling upgrade-scripts speific for the WAN radio operation. This way, the config mode interface can be removed seperately from the core functionality to perform tasks on system upgrade. This can be useful when the setup-mode is removed entirely for space preservation. --- package/gluon-private-wifi/Makefile | 13 +++++++++++++ .../lib/gluon/upgrade/325-gluon-private-wifi | 18 ++++++++++++++++++ package/gluon-web-private-wifi/Makefile | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 package/gluon-private-wifi/Makefile create mode 100755 package/gluon-private-wifi/luasrc/lib/gluon/upgrade/325-gluon-private-wifi diff --git a/package/gluon-private-wifi/Makefile b/package/gluon-private-wifi/Makefile new file mode 100644 index 00000000..622334b5 --- /dev/null +++ b/package/gluon-private-wifi/Makefile @@ -0,0 +1,13 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-private-wifi +PKG_VERSION:=1 + +include ../gluon.mk + +define Package/gluon-private-wifi + TITLE:=Provides a virtual access point for the nodes WAN network + DEPENDS:=+gluon-core +endef + +$(eval $(call BuildPackageGluon,gluon-private-wifi)) diff --git a/package/gluon-private-wifi/luasrc/lib/gluon/upgrade/325-gluon-private-wifi b/package/gluon-private-wifi/luasrc/lib/gluon/upgrade/325-gluon-private-wifi new file mode 100755 index 00000000..2f46267b --- /dev/null +++ b/package/gluon-private-wifi/luasrc/lib/gluon/upgrade/325-gluon-private-wifi @@ -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 = "wan_" .. 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') diff --git a/package/gluon-web-private-wifi/Makefile b/package/gluon-web-private-wifi/Makefile index cff13fcb..f016abf4 100644 --- a/package/gluon-web-private-wifi/Makefile +++ b/package/gluon-web-private-wifi/Makefile @@ -7,7 +7,7 @@ PKG_RELEASE:=1 include ../gluon.mk define Package/gluon-web-private-wifi - DEPENDS:=+gluon-web-admin + DEPENDS:=+gluon-web-admin +gluon-private-wifi TITLE:=UI for activating a private WLAN endef