diff --git a/Makefile.am b/Makefile.am index b6dcb849fb..3be5949b02 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,114 +1,130 @@ # # Copyright 2003-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # # m4/glibtests.m4 is copied from https://gitlab.gnome.org/GNOME/glib/blob/master/m4macros/glibtests.m4. EXTRA_DIST = CONTRIBUTING.md \ GNUmakefile \ INSTALL.md \ README.markdown \ autogen.sh \ m4/glibtests.m4 \ m4/gnulib-cache.m4 \ m4/gnulib-tool.m4 \ rpm/rpmlintrc \ rpm/pacemaker.spec.in DISTCLEANFILES = config.status MAINTAINERCLEANFILES = Makefile.in \ aclocal.m4 \ config.guess \ config.sub \ configure \ depcomp \ install-sh \ ltmain.sh \ missing \ py-compile \ test-driver # Don't try to install files outside build directory for "make distcheck". AM_DISTCHECK_CONFIGURE_FLAGS = --prefix="$$dc_install_base/usr" \ --sysconfdir="$$dc_install_base/etc" \ --with-initdir="$$dc_install_base/etc/init.d" \ --with-ocfdir="$$dc_install_base/usr/lib/ocf" \ --with-systemdsystemunitdir="$$dc_install_base$(systemdsystemunitdir)" # Only these will get installed with a plain "make install" CORE_INSTALL = replace include lib daemons tools xml # Only these will get built with a plain "make" or "make clean" CORE = $(CORE_INSTALL) cts SUBDIRS = $(CORE) devel doc extra maint tests AM_CPPFLAGS = -I$(top_srcdir)/include doc_DATA = README.markdown COPYING licensedir = $(docdir)/licenses/ dist_license_DATA = $(wildcard licenses/*) # Scratch file for ad-hoc testing EXTRA_PROGRAMS = scratch nodist_scratch_SOURCES = scratch.c scratch_LDADD = $(top_builddir)/lib/common/libcrmcommon.la +# Directories that should be created on install and removed on uninstall +## owned by root:haclient, mode 0750 +ROOT_DIRS = $(PACEMAKER_CONFIG_DIR) +## owned by hacluster:haclient, mode 0750 +DAEMON_R_DIRS = $(CRM_CONFIG_DIR) \ + $(CRM_CORE_DIR) \ + $(CRM_BLACKBOX_DIR) +## owned by hacluster:haclient, mode 0770 +DAEMON_RW_DIRS = $(CRM_BUNDLE_DIR) \ + $(CRM_LOG_DIR) + core: @echo "Building only core components and tests: $(CORE)" @for subdir in $(CORE); do \ echo "Building $$subdir"; \ $(MAKE) $(AM_MAKEFLAGS) -C $$subdir all || exit 1; \ done core-install: @echo "Installing only core components: $(CORE_INSTALL)" @for subdir in $(CORE_INSTALL); do \ echo "Installing $$subdir"; \ $(MAKE) $(AM_MAKEFLAGS) -C $$subdir install || exit 1; \ done core-clean: @echo "Cleaning only core components and tests: $(CORE)" @for subdir in $(CORE); do \ echo "Cleaning $$subdir"; \ $(MAKE) $(AM_MAKEFLAGS) -C $$subdir clean || exit 1; \ done install-exec-local: - $(INSTALL) -d -m 750 $(DESTDIR)/$(PACEMAKER_CONFIG_DIR) - $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CONFIG_DIR) - $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_CORE_DIR) - $(INSTALL) -d -m 750 $(DESTDIR)/$(CRM_BLACKBOX_DIR) - $(INSTALL) -d -m 770 $(DESTDIR)/$(CRM_LOG_DIR) - $(INSTALL) -d -m 770 $(DESTDIR)/$(CRM_BUNDLE_DIR) - -chgrp $(CRM_DAEMON_GROUP) $(DESTDIR)/$(PACEMAKER_CONFIG_DIR) - -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CONFIG_DIR) - -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_CORE_DIR) - -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_BLACKBOX_DIR) - -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_LOG_DIR) - -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(CRM_BUNDLE_DIR) -# Use chown because the user/group may not exist + for DIR in $(ROOT_DIRS) $(DAEMON_R_DIRS); do \ + $(INSTALL) -d -m 750 "$(DESTDIR)/$$DIR"; \ + done + for DIR in $(DAEMON_RW_DIRS); do \ + $(INSTALL) -d -m 770 "$(DESTDIR)/$$DIR"; \ + done + -for DIR in $(ROOT_DIRS); do \ + chgrp $(CRM_DAEMON_GROUP) "$(DESTDIR)/$$DIR"; \ + done + -for DIR in $(DAEMON_R_DIRS) $(DAEMON_RW_DIRS); do \ + chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) "$(DESTDIR)/$$DIR"; \ + done + +# Remove created directories only if they're empty +uninstall-hook: + -for DIR in $(ROOT_DIRS) $(DAEMON_R_DIRS) $(DAEMON_RW_DIRS); do \ + rmdir "$(DESTDIR)/$$DIR"; \ + done clean-generic: -rm -f *.tar.bz2 *.sed PACKAGE ?= pacemaker # In a normal build, this file is included by GNUmakefile, which serves as the # "real" makefile. But in a VPATH build, GNUmakefile won't exist in the build # tree, and this file will be the "real" makefile. EXTRA_CLEAN_TARGETS handles # both cases: GNUmakefile defines it before including this file, so the # clean-local target can clean up files created by GNUmakefile targets. # If this file is used alone, the variable will be undefined. clean-local: $(EXTRA_CLEAN_TARGETS) -rm -f scratch $(builddir)/$(PACKAGE)-*.tar.gz distclean-local: -rm -rf libltdl autom4te.cache diff --git a/daemons/based/Makefile.am b/daemons/based/Makefile.am index a3c49c9c9f..d91b7e4b6f 100644 --- a/daemons/based/Makefile.am +++ b/daemons/based/Makefile.am @@ -1,55 +1,50 @@ # -# Copyright 2004-2018 the Pacemaker project contributors +# Copyright 2004-2020 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/mk/common.mk EXTRA_DIST = cib.pam halibdir = $(CRM_DAEMON_DIR) COMMONLIBS = $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cib/libcib.la halib_PROGRAMS = pacemaker-based cibmon noinst_HEADERS = pacemaker-based.h pacemaker_based_CFLAGS = $(CFLAGS_HARDENED_EXE) pacemaker_based_LDFLAGS = $(LDFLAGS_HARDENED_EXE) pacemaker_based_LDADD = $(top_builddir)/lib/cluster/libcrmcluster.la \ $(COMMONLIBS) $(CLUSTERLIBS) pacemaker_based_SOURCES = pacemaker-based.c \ based_callbacks.c \ based_common.c \ based_io.c \ based_messages.c \ based_notify.c \ based_remote.c cibmon_LDADD = $(COMMONLIBS) cibmon_SOURCES = cibmon.c clean-generic: rm -f *.log *.debug *.xml *~ -install-exec-local: -# cp -f $(top_srcdir)/crm/cib/cib.pam $(DESTDIR)/etc/pam.d/cib - if BUILD_LEGACY_LINKS install-exec-hook: $(MKDIR_P) -- $(DESTDIR)$(CRM_DAEMON_DIR) cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f cib && $(LN_S) pacemaker-based cib uninstall-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f cib endif - -uninstall-local: diff --git a/daemons/schedulerd/Makefile.am b/daemons/schedulerd/Makefile.am index ef24cfb764..c5e97aa6a7 100644 --- a/daemons/schedulerd/Makefile.am +++ b/daemons/schedulerd/Makefile.am @@ -1,50 +1,49 @@ # # Copyright 2004-2019 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # include $(top_srcdir)/mk/common.mk AM_CPPFLAGS += -I$(top_builddir) -I$(top_srcdir) halibdir = $(CRM_DAEMON_DIR) ## binary progs halib_PROGRAMS = pacemaker-schedulerd if BUILD_XML_HELP man7_MANS = pacemaker-schedulerd.7 endif ## SOURCES pacemaker_schedulerd_CFLAGS = $(CFLAGS_HARDENED_EXE) pacemaker_schedulerd_LDFLAGS = $(LDFLAGS_HARDENED_EXE) pacemaker_schedulerd_LDADD = $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/lib/pacemaker/libpacemaker.la # libcib for get_object_root() pacemaker_schedulerd_SOURCES = pacemaker-schedulerd.c install-exec-local: - $(mkinstalldirs) $(DESTDIR)/$(PE_STATE_DIR) - -chown $(CRM_DAEMON_USER) $(DESTDIR)/$(PE_STATE_DIR) - -chgrp $(CRM_DAEMON_GROUP) $(DESTDIR)/$(PE_STATE_DIR) - -chmod 750 $(DESTDIR)/$(PE_STATE_DIR) + $(INSTALL) -d -m 750 $(DESTDIR)/$(PE_STATE_DIR) + -chown $(CRM_DAEMON_USER):$(CRM_DAEMON_GROUP) $(DESTDIR)/$(PE_STATE_DIR) if BUILD_LEGACY_LINKS install-exec-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f pengine && $(LN_S) pacemaker-schedulerd pengine uninstall-hook: cd $(DESTDIR)$(CRM_DAEMON_DIR) && rm -f pengine endif uninstall-local: + -rmdir $(DESTDIR)/$(PE_STATE_DIR) CLEANFILES = $(man7_MANS)