openwisp-monitoring: allow not depending on rpcd-mod-iwinfo
authorGagan Deep <pandafy.dev@gmail.com>
Tue, 29 Oct 2024 15:51:55 +0000 (21:21 +0530)
committerTianling Shen <cnsztl@gmail.com>
Mon, 18 Nov 2024 07:07:50 +0000 (15:07 +0800)
Add option to exclude rpcd-mod-iwinfo from dependency.

Signed-off-by: Gagan Deep <pandafy.dev@gmail.com>
(cherry picked from commit ca503cc4054d9a13558c7b552886a6dba359a0eb)

admin/openwisp-monitoring/Config.in [new file with mode: 0644]
admin/openwisp-monitoring/Makefile

diff --git a/admin/openwisp-monitoring/Config.in b/admin/openwisp-monitoring/Config.in
new file mode 100644 (file)
index 0000000..5b5bf37
--- /dev/null
@@ -0,0 +1,9 @@
+menu "netjson-monitoring Configuration"
+
+config NETJSON_MONITORING_IWINFO
+       bool "Enable rpcd-mod-iwinfo"
+       default y
+       help
+         Whether to include the rpcd-mod-iwinfo dependency (enabled by default).
+
+endmenu
index 7489049d3a35ec6d256614d93e8ebf9427847695..65ed47ac67aeaf8de48179c37214141b67072f7b 100644 (file)
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openwisp-monitoring
 PKG_VERSION:=0.2.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_MAINTAINER:=Federico Capoano <support@openwisp.io>
 PKG_LICENSE:=GPL-3.0-or-later
@@ -34,10 +34,15 @@ define Package/netjson-monitoring
   CATEGORY:=Administration
   SECTION:=admin
   SUBMENU:=openwisp
-  DEPENDS:=+libubus-lua +lua-cjson +rpcd +rpcd-mod-iwinfo
+  DEPENDS:=+libubus-lua +lua-cjson +rpcd
+  DEPENDS+=+NETJSON_MONITORING_IWINFO:rpcd-mod-iwinfo
   URL:=http://openwisp.org
 endef
 
+define Package/netjson-monitoring/config
+  source "$(SOURCE)/Config.in"
+endef
+
 define Build/Compile
 endef
 
@@ -88,6 +93,11 @@ define Package/netjson-monitoring/install
                $(PKG_BUILD_DIR)/openwisp-monitoring/files/lib/openwisp-monitoring/wifi.lua \
                $(1)/usr/lib/lua/openwisp-monitoring/wifi.lua
 
+# Iwinfo is enabled by default unless specified otherwise
+ifeq ($(CONFIG_NETJSON_MONITORING_IWINFO), y)
+       $(CP) $(PKG_BUILD_DIR)/openwisp-monitoring/files/lib/openwisp-monitoring/iwinfo.lua $(1)/usr/lib/lua/openwisp-monitoring/iwinfo.lua
+endif
+
        $(CP) $(PKG_BUILD_DIR)/VERSION $(1)/usr/lib/openwisp-monitoring/
 
 endef