Skip to content

Commit

Permalink
[fix] Simplified compiling package without iwinfo
Browse files Browse the repository at this point in the history
Copy iwinfo.lua only when CONFIG_NETJSON_MONITORING_IWINFO is set
to true.
  • Loading branch information
pandafy committed Nov 7, 2024
1 parent 49ea073 commit 50913b2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions openwisp-monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ define Package/netjson-monitoring/install
$(1)/usr/lib/lua/openwisp-monitoring/wifi.lua

# Iwinfo is enabled by default unless specified otherwise
$(INSTALL_DIR) $(1)/usr/lib/lua/openwisp-monitoring
sed 's/true/$(if $(CONFIG_NETJSON_MONITORING_IWINFO),true,false)/' \
files/lib/openwisp-monitoring/iwinfo.lua > $(1)/usr/lib/lua/openwisp-monitoring/iwinfo.lua
ifeq ($(CONFIG_NETJSON_MONITORING_IWINFO), y)
$(CP) files/lib/openwisp-monitoring/iwinfo.lua $(1)/usr/lib/lua/openwisp-monitoring/iwinfo.lua
endif

$(CP) ../VERSION $(1)/usr/lib/openwisp-monitoring/
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ monitoring.neighbors = require('openwisp-monitoring.neighbors')
monitoring.resources = require('openwisp-monitoring.resources')
monitoring.utils = require('openwisp-monitoring.utils')
monitoring.wifi = require('openwisp-monitoring.wifi')
monitoring.iwinfo = require('openwisp-monitoring.iwinfo')

local success, iwinfo = pcall(require, 'openwisp-monitoring.iwinfo')
if success then
monitoring.iwinfo = iwinfo
else
monitoring.iwinfo = {
enabled = false
}
end

return monitoring

0 comments on commit 50913b2

Please sign in to comment.