Makefile: fix assembly of plugins

Source: package "300-fix-munin-node-assembly" from Opennet Firmware
This commit is contained in:
Lars Kruse 2019-07-19 06:08:23 +02:00
parent 56bf90a6f8
commit eb5f13e9bd
1 changed files with 11 additions and 10 deletions

View File

@ -4,20 +4,21 @@ PLUGINS=df cpu if_ if_err_ load memory processes swap netstat uptime interrupts
#PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats #PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats
munin-node: plugins/* munin-node.conf munin-node: plugins/* munin-node.conf
@VERSION=$$(cat VERSION); \ @export VERSION=$$(cat VERSION); \
CONF=$$(grep -v '^#' munin-node.conf); \ export CONF=$$(grep -v '^#' munin-node.conf); \
export "PLUGINS=$(PLUGINS)"; \
echo "Making munin-node for muninlite version $$VERSION"; \ echo "Making munin-node for muninlite version $$VERSION"; \
PLSTR=""; \ export PLSTR=""; \
for PLGIN in $(PLUGINS); \ for PLGIN in $$PLUGINS; \
do \ do \
echo "Adding plugin $$PLGIN"; \ echo "Adding plugin $$PLGIN"; \
PLSTR=$$(echo "$$PLSTR"; grep -v '^#' plugins/$$PLGIN); \ PLSTR=$$(printf "%s\n" "$$PLSTR"; grep -v '^#' plugins/$$PLGIN); \
done; \ done; \
PLSTR=$$(echo "$$PLSTR" | sed -e 's/\\/\\\\/g' \ perl -p -e '\
-e 's/\//\\\//g' \ s/\@\@VERSION\@\@/$$ENV{"VERSION"}/; \
-e 's/\$$/\\$$/g'); \ s/\@\@CONF\@\@/$$ENV{"CONF"}/; \
perl -p -e \ s/\@\@PLUGINS\@\@/$$ENV{"PLUGINS"}/; \
"s/\@\@VERSION\@\@/$$VERSION/;s/\@\@CONF\@\@/$$CONF/;s/\@\@PLUGINS\@\@/$(PLUGINS)/;s/\@\@PLSTR\@\@/$$PLSTR/;" \ s/\@\@PLSTR\@\@/$$ENV{"PLSTR"}/;' \
munin-node.in > munin-node munin-node.in > munin-node
@chmod +x munin-node @chmod +x munin-node