$NetBSD: patch-Makefile.config,v 1.1 2019/09/09 12:21:44 tm Exp $ Define proper default locations and tools. Really need Bash for plugins despite what upstream says. --- Makefile.config.orig 2019-01-17 12:20:47.528006286 +0000 +++ Makefile.config @@ -17,35 +17,38 @@ # # the base of the Munin installation. # -PREFIX = $(DESTDIR)/opt/munin +UPREFIX = $(DESTDIR)$(PREFIX) # Where Munin keeps its configurations (server.conf, client.conf, ++) -CONFDIR = $(DESTDIR)/etc/opt/munin +# CONFDIR = $(UPREFIX)/etc/munin + +# Where pkgsrc installs example config files +EGDIR = $(UPREFIX)/share/examples/munin # Server only - where to put munin-cron -BINDIR = $(PREFIX)/bin +BINDIR = $(UPREFIX)/bin # Client only - where to put munin-node, munin-node-configure, and munin-run -SBINDIR = $(PREFIX)/sbin +SBINDIR = $(UPREFIX)/sbin # Where to put text and html documentation -DOCDIR = $(PREFIX)/doc +DOCDIR = $(UPREFIX)/share/doc/munin # Where to put man pages -MANDIR = $(PREFIX)/man +MANDIR = $(UPREFIX)/$(PKGMANDIR) # Where to put internal binaries and plugin repository -LIBDIR = $(PREFIX)/lib +LIBDIR = $(UPREFIX)/lib/munin # Server only - Output directory -HTMLDIR = $(PREFIX)/www/docs -CGIDIR = $(PREFIX)/www/cgi +HTMLDIR = $(DESTDIR)/$(MUNIN_WWWDIR)/munin/data +CGIDIR = $(DESTDIR)/$(MUNIN_WWWDIR)/cgi-bin # Where to put internal data for master (RRD, internal files, ...) -DBDIR = $(DESTDIR)/var/opt/munin +DBDIR = $(MUNIN_DBDIR) # Where to put internal data for node (plugin state, ...) -DBDIRNODE = $(DESTDIR)/var/opt/munin-node +DBDIRNODE = $(DBDIR) # Client only - Where the spool files are written. Must be writable by # group "munin", and should be preserved between reboots @@ -56,23 +59,23 @@ SPOOLDIR = $(DBDIR)/spool PLUGSTATE = $(DBDIRNODE)/plugin-state # Where Munin should place its logs. -LOGDIR = $(PREFIX)/log/munin +LOGDIR = $(MUNIN_LOGDIR) # Location of PID files and other statefiles. On the server, must be # writable by the user "munin". -STATEDIR = $(DESTDIR)/var/run/munin +STATEDIR = $(MUNIN_STATEDIR) # The perl interpreter to use -PERL := $(shell which perl) +PERL := $(PERL5) # The python interpreter to use (used by some plugins) -PYTHON := /usr/bin/env python3 +PYTHON := $(PYTHONBIN) # The ruby interpreter to use (used by some plugins) -RUBY := /usr/bin/env ruby +RUBY := $(RUBY) # The java runtime to use (used by some plugins) -JAVARUN := /usr/bin/java +JAVARUN := $(JAVA_HOME)/bin/java # The java library dir to use (used by some plugins) # this is needed in order to be able to install @@ -89,13 +92,14 @@ JAVALIBDIR = $(LIBDIR) # On Linux /bin/sh, SunOS/Solaris /usr/xpg4/bin/sh or /bin/ksh # In general: bash or ksh will work # -GOODSH := $(shell PATH=`getconf PATH 2>/dev/null || echo $(PATH)` LANG=C sh -c 'type sh | sed "s/.* //"') +GOODSH := $(BASH) # Path of bash for bash specific plugins -BASH := /bin/bash +BASH := $(BASH) # Server only - Where to install the perl libraries -PERLLIB = $(DESTDIR)$(shell $(PERL) -V:sitelib | cut -d"'" -f2) +PERLVENDORLIB := $(shell $(PERL) -V:vendorlib | cut -d"'" -f2) +PERLLIB = $(DESTDIR)$(PERLVENDORLIB) # Client only - Install plugins for this architecture # the LANG=C makes tr work as expected, not regarding any locale it @@ -116,8 +120,8 @@ MKTEMP := $(shell ./test-mktemp) VERSION := $(shell ./getversion) # User to run munin as -USER := munin -GROUP := munin +USER := $(MUNIN_USER) +GROUP := $(MUNIN_GROUP) # Default user to run the plugins as PLUGINUSER := nobody @@ -125,32 +129,8 @@ PLUGINUSER := nobody # Default user to run the cgi as CGIUSER := nobody -# Which command to use to check if the USER and GROUP to run Munin as, exists. -ifneq ($(shell which getent),) - # "getent" works on most modern OS - CHECKUSER_COMMAND := getent passwd $(USER) - CHECKGROUP_COMMAND := getent group $(GROUP) -else - ifeq ($(OSTYPE),darwin) - # This should work for OSX 10.5 (Leopard) or later - CHECKUSER_COMMAND := dscl . -read /Users/$(USER) - CHECKGROUP_COMMAND := dscl . -read /Groups/$(GROUP) - else - ifeq ($(OSTYPE),cygwin) - CHECKUSER_COMMAND := id $(USER) - CHECKGROUP_COMMAND := grep ^$(GROUP): /etc/group - else - ifeq ($(OSTYPE),hp-ux) - CHECKUSER_COMMAND := pwget -n $(USER) - CHECKGROUP_COMMAND := grget -n $(GROUP) - else - $(warning Missing test for user existence on this platform. Skipping this check and hoping for the best ...) - CHECKUSER_COMMAND := true - CHECKGROUP_COMMAND := true - endif - endif - endif -endif +CHECKUSER_COMMAND := true +CHECKGROUP_COMMAND := true CHECKUSER := $(shell $(CHECKUSER_COMMAND) >/dev/null 2>/dev/null || (echo "echo User $(USER) nonexistent. Create the user and retry; exit 2")) CHECKGROUP := $(shell $(CHECKGROUP_COMMAND) >/dev/null 2>/dev/null || (echo "echo Group $(GROUP) nonexistent. Create the group and retry; exit 2")) @@ -159,7 +139,7 @@ CHMOD := chmod CHGRP := chgrp # Java compiler stuff - only needed on the buildhost -JC := javac +JC := $(JAVA_HOME)/bin/javac JFLAGS := -g -source 1.7 -target 1.7 -Xlint JAR := jar