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 5bcb9c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 4 additions & 4 deletions openwisp-monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ define Package/netjson-monitoring/install
files/lib/openwisp-monitoring/wifi.lua \
$(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
# Iwinfo is enabled by default unless specified otherwise
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 5bcb9c1

Please sign in to comment.