summaryrefslogtreecommitdiffstats
path: root/rules/munin.make
blob: f742ab33469d251dc6959f2987e6741875202ceb (plain)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*-makefile-*-
#
# Copyright (C) 2014 by Michael Olbrich <m.olbrich@pengutronix.de>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_MUNIN) += munin

#
# Paths and names
#
MUNIN_VERSION	:= 2.0.20
MUNIN_MD5	:= 08ba9c8a5b53b217eaac1c1fa592f3de
MUNIN		:= munin-$(MUNIN_VERSION)
MUNIN_SUFFIX	:= tar.gz
MUNIN_URL	:= $(call ptx/mirror, SF, munin/$(MUNIN).$(MUNIN_SUFFIX))
MUNIN_SOURCE	:= $(SRCDIR)/$(MUNIN).$(MUNIN_SUFFIX)
MUNIN_DIR	:= $(BUILDDIR)/$(MUNIN)
MUNIN_LICENSE	:= GPL-2.0
MUNIN_MAKE_PAR	:= NO

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

MUNIN_CONFIG	:= $(MUNIN_DIR)/Makefile.config.ptx

$(STATEDIR)/munin.prepare:
	@$(call targetinfo)
	@echo '# Generated by PTXdist'						>  $(MUNIN_CONFIG)
	@echo 'PREFIX = $$(DESTDIR)/usr'					>> $(MUNIN_CONFIG)
	@echo 'CONFDIR = $$(DESTDIR)/etc/munin'					>> $(MUNIN_CONFIG)
	@echo 'LIBDIR = $$(PREFIX)/lib/munin'					>> $(MUNIN_CONFIG)
	@echo 'HTMLDIR = $$(DESTDIR)/var/www/munin'				>> $(MUNIN_CONFIG)
	@echo 'CGIDIR = $$(HTMLDIR)/cgi'					>> $(MUNIN_CONFIG)
	@echo 'DBDIR = $$(DESTDIR)/var/munin'					>> $(MUNIN_CONFIG)
	@echo 'DBDIRNODE = $$(DESTDIR)/var/munin-node'				>> $(MUNIN_CONFIG)
	@echo 'LOGDIR = $$(DESTDIR)/var/log'					>> $(MUNIN_CONFIG)
	@echo 'STATEDIR = $$(DESTDIR)/run'					>> $(MUNIN_CONFIG)
	@echo 'PERL = /usr/bin/perl'						>> $(MUNIN_CONFIG)
	@echo 'GOODSH = /bin/bash'						>> $(MUNIN_CONFIG)
	@echo 'PERLSITELIB = $(PERL_SITELIB)'					>> $(MUNIN_CONFIG)
	@echo 'OSTYPE = linux'							>> $(MUNIN_CONFIG)
	@echo 'HOSTNAME = $(call remove_quotes,$(PTXCONF_ROOTFS_ETC_HOSTNAME))'	>> $(MUNIN_CONFIG)
	@echo 'MKTEMP = mktemp -p /tmp/ $$1'					>> $(MUNIN_CONFIG)
	@echo 'VERSION = $(MUNIN_VERSION)'					>> $(MUNIN_CONFIG)
	@echo 'USER = root'							>> $(MUNIN_CONFIG)
	@echo 'GROUP = root'							>> $(MUNIN_CONFIG)
	@echo 'CHECKUSER ='							>> $(MUNIN_CONFIG)
	@echo 'CHECKGROUP ='							>> $(MUNIN_CONFIG)
	@echo 'JCVALID = no'							>> $(MUNIN_CONFIG)
	@echo 'HASSETR = 1'							>> $(MUNIN_CONFIG)
	@$(call touch)

MUNIN_MAKE_ENV		:= $(CROSS_ENV)
MUNIN_MAKE_OPT		:= CONFIG=$(MUNIN_CONFIG)
MUNIN_INSTALL_OPT	:= CONFIG=$(MUNIN_CONFIG) install

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

MONIN_TOOLS := \
	munin-async \
	munin-asyncd \
	munin-datafile2storable \
	munin-graph \
	munin-html \
	munin-limits \
	munin-storable2datafile \
	munin-update

$(STATEDIR)/munin.targetinstall:
	@$(call targetinfo)

	@$(call install_init, munin)
	@$(call install_fixup, munin,PRIORITY,optional)
	@$(call install_fixup, munin,SECTION,base)
	@$(call install_fixup, munin,AUTHOR,"Michael Olbrich <m.olbrich@pengutronix.de>")
	@$(call install_fixup, munin,DESCRIPTION,missing)

	@$(call install_tree, munin, 0, 0, -, /usr/lib/munin/plugins)
	@$(call install_copy, munin, 0, 0, 0644, -, $(PERL_SITELIB)/Munin/Plugin.pm)
	@$(call install_tree, munin, 0, 0, -, $(PERL_SITELIB)/Munin/Plugin)
	@$(call install_tree, munin, 0, 0, -, $(PERL_SITELIB)/Munin/Common)
ifdef PTXCONF_MUNIN_MASTER
	@$(call install_alternative, munin, 0, 0, 0644, /etc/munin/munin.conf)
	@$(call install_tree, munin, 0, 0, -, /etc/munin/templates)
	@$(call install_tree, munin, 0, 0, -, /etc/munin/static)

	@$(call install_copy, munin, 0, 0, 0755, -, /usr/bin/munin-cron)
	@$(call install_copy, munin, 0, 0, 0755, -, /usr/bin/munin-check)

	@$(foreach tool, $(MONIN_TOOLS), \
		$(call install_copy, munin, 0, 0, 0755, -, /usr/lib/munin/$(tool));)

	@$(call install_tree, munin, 0, 0, -, $(PERL_SITELIB)/Munin/Master)
endif
ifdef PTXCONF_MUNIN_NODE
	@$(call install_alternative, munin, 0, 0, 0644, /etc/munin/munin-node.conf)
	@$(call install_copy, munin, 0, 0, 0755, /etc/munin/plugin-conf.d/)
	@$(call install_copy, munin, 0, 0, 0755, /etc/munin/plugins/)
	@$(foreach plugin, $(call remove_quotes,$(PTXCONF_MUNIN_NODE_PLUGINS)), \
		$(call install_link, munin, /usr/lib/munin/plugins/$(plugin), \
		/etc/munin/plugins/$(plugin));)

	@$(call install_copy, munin, 0, 0, 0755, -, /usr/sbin/munin-node-configure)
	@$(call install_copy, munin, 0, 0, 0755, -, /usr/sbin/munin-sched)
	@$(call install_copy, munin, 0, 0, 0755, -, /usr/sbin/munin-run)
	@$(call install_copy, munin, 0, 0, 0755, -, /usr/sbin/munin-node)

	@$(call install_tree, munin, 0, 0, -, $(PERL_SITELIB)/Munin/Node)
ifdef PTXCONF_MUNIN_NODE_SYSTEMD_UNIT
	@$(call install_alternative, munin, 0, 0, 0644, \
		/lib/systemd/system/munin-node.service)
	@$(call install_link, munin, ../munin-node.service, \
		/lib/systemd/system/multi-user.target.wants/munin-node.service)
endif
endif
	@$(call install_finish, munin)

	@$(call touch)

# vim: syntax=make