From c547314f3d09998149e8141d780ec5b43fd9cefe Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Thu, 6 Feb 2020 08:10:10 +0100 Subject: [PATCH] Makefile: add "install" target --- Makefile | 8 ++++++++ README.md | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6f211bc..b683b66 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ PLUGIN_DIRECTORY ?= plugins PLUGIN_FILES = $(patsubst %,$(PLUGIN_DIRECTORY)/%,$(PLUGINS)) VERSION ?= $(shell cat VERSION) DIST_DIR = releases +DESTDIR ?= /usr/local/bin TGZ_FILE ?= $(DIST_DIR)/muninlite-$(VERSION).tar.gz @@ -32,6 +33,7 @@ help: @$(info all - assemble 'TARGET_FILE' ($(TARGET_FILE))) @$(info clean - remove assembled 'TARGET_FILE' ($(TARGET_FILE))) @$(info clean-all - remove old releases from 'DIST_DIR' ($(DIST_DIR))) + @$(info install - install the standalone shell script) @$(info help - show this overview) @$(info lint - code style checks) @$(info spelling - check spelling) @@ -66,6 +68,12 @@ $(TGZ_FILE): git archive --prefix=muninlite-$(VERSION)/ --format=tar --output "$@.tmp" HEAD mv "$@.tmp" "$@" +.PHONY: install +install: $(TARGET_FILE) + mkdir -p "$(dir $(DESTDIR))" + cp "$(TARGET_FILE)" "$(DESTDIR)/" + + .PHONY: lint lint: shellcheck -s dash --exclude=SC2230 $(PLUGIN_FILES) "$(INPUT_FILE)" diff --git a/README.md b/README.md index bc1f23d..7d63798 100644 --- a/README.md +++ b/README.md @@ -55,11 +55,10 @@ You may assemble a reduced script by including only specific plugins: $ make PLUGINS="cpu load uptime" ``` -Copy munin-node to a suitable location (/usr/local/bin/) and make it -executable (there will be a "make install" at a later release) +Run `make install` or simply copy `munin-node` to a suitable location. ```shell -cp munin-node /usr/local/bin +make install ``` Two typical ways of using MuninLite as a `munin-node` replacement are: