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 ecd1c91
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 2 additions & 3 deletions openwisp-monitoring/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,8 @@ 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
[ "$(CONFIG_NETJSON_MONITORING_IWINFO)" = "y" ] && \
$(CP) files/lib/openwisp-monitoring/iwinfo.lua $(1)/usr/lib/lua/openwisp-monitoring/iwinfo.lua

$(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 ecd1c91

Please sign in to comment.