forked from glensc/nagios-plugin-check_raid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (35 loc) · 1.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Makefile for check_raid plugin
PLUGIN := check_raid
PLUGIN_SCRIPT := $(PLUGIN).pl
PLUGIN_VERSION := $(shell test -e .git && git describe --tags || awk -F'"' '/VERSION/&&/=/{print $$2}' $(PLUGIN_SCRIPT))
PLUGINDIR := /usr/lib/nagios/plugins
PLUGINCONF := /etc/nagios/plugins
all:
test:
perl -MTest::Harness -e 'runtests @ARGV' t/*.t
release:
@echo "Checking for tag"; \
V=`./$(PLUGIN_SCRIPT) -V | cut -d' ' -f3`; \
T=`git tag -l $$V`; \
if [ -n "$$T" ]; then \
echo >&2 "Tag $$T already exists"; \
exit 1; \
fi; \
R=`git rev-parse HEAD`; \
echo "RELEASE: create version $$V at $$R"; \
git tag -a "$$V" $$R; \
echo "Don't forget to push: git push origin refs/tags/$$V"
install:
install -d $(DESTDIR)$(PLUGINDIR)
install -p $(PLUGIN_SCRIPT) $(DESTDIR)$(PLUGINDIR)/$(PLUGIN)
install -d $(DESTDIR)$(PLUGINCONF)
cp -p $(PLUGIN).cfg $(DESTDIR)$(PLUGINCONF)
dist:
rm -rf $(PLUGIN)-$(PLUGIN_VERSION)
install -d $(PLUGIN)-$(PLUGIN_VERSION)
install -p $(PLUGIN_SCRIPT) $(PLUGIN)-$(PLUGIN_VERSION)/$(PLUGIN)
cp -a check_raid.cfg t $(PLUGIN)-$(PLUGIN_VERSION)
tar --exclude-vcs -czf $(PLUGIN)-$(PLUGIN_VERSION).tar.gz $(PLUGIN)-$(PLUGIN_VERSION)
rm -rf $(PLUGIN)-$(PLUGIN_VERSION)
md5sum -b $(PLUGIN)-$(PLUGIN_VERSION).tar.gz > $(PLUGIN)-$(PLUGIN_VERSION).tar.gz.md5
chmod 644 $(PLUGIN)-$(PLUGIN_VERSION).tar.gz $(PLUGIN)-$(PLUGIN_VERSION).tar.gz.md5