device-mapper-multipath/0029-multipath-tools-Makefile-sanitize-paths-for-configur.patch
Benjamin Marzinski e5eddaae1a device-mapper-multipath-0.9.6-1
Update to the head of the upstream staging branch
Rename redhat patches
  * Previous patches 0001-0012 are now patches 0041-0052
Add 0053-RH-Add-mpathcleanup.patch
  * add mpathcleanup program
2023-09-22 15:29:43 -05:00

74 lines
3.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 8 Sep 2023 22:13:51 +0200
Subject: [PATCH] multipath-tools Makefile: sanitize paths for configuration
files
Make the path to multipath.conf configurable, and use the same prefix
by default for multipath.conf and multipath/conf.d. For "usr-merged"
distributions with immutable /usr, we'll want to have the configuration
under a different prefix. This can be achieved by using e.g.
make prefix=/usr etc_prefix=""
Note that with prefix=/usr, before this patch the code would use
/usr/etc/multipath/conf.d, but /etc/multipath.conf. If this (rather
inconsistent) behavior is desired, use the following command line:
make prefix=/usr configfile=/etc/multipath.conf
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 9 ++++++---
libmultipath/defaults.h | 1 -
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 502cd0f1..39972d93 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -37,6 +37,8 @@ prefix :=
exec_prefix := $(prefix)
# Prefix for non-essential libraries (libdmmp)
usr_prefix := $(prefix)
+# Prefix for configfuration files (multipath.conf)
+etc_prefix := $(prefix)
# Where to install systemd-related files. systemd is usually installed under /usr
# Note: some systemd installations use separate "prefix" and "rootprefix".
# In this case, override only unitdir to use systemd's "rootprefix" instead of $(systemd_prefix)
@@ -54,7 +56,8 @@ usrlibdir := $(usr_prefix)/$(LIB)
includedir := $(usr_prefix)/include
pkgconfdir := $(usrlibdir)/pkgconfig
plugindir := $(prefix)/$(LIB)/multipath
-configdir := $(prefix)/etc/multipath/conf.d
+configdir := $(etc_prefix)/etc/multipath/conf.d
+configfile := $(etc_prefix)/etc/multipath.conf
runtimedir := $(if $(shell test -L /var/run -o ! -d /var/run && echo 1),/run,/var/run)
devmapper_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir devmapper),/usr/include)
libudev_incdir := $(or $(shell $(PKG_CONFIG) --variable=includedir libudev),/usr/include)
@@ -84,8 +87,8 @@ WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implici
$(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) $(W_URCU_TYPE_LIMITS)
CPPFLAGS := $(FORTIFY_OPT) $(CPPFLAGS) \
-DBIN_DIR=\"$(bindir)\" -DMULTIPATH_DIR=\"$(plugindir)\" \
- -DRUNTIME_DIR=\"$(runtimedir)\" \
- -DCONFIG_DIR=\"$(configdir)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
+ -DRUNTIME_DIR=\"$(runtimedir)\" -DCONFIG_DIR=\"$(configdir)\" \
+ -DDEFAULT_CONFIGFILE=\"$(configfile)\" -DEXTRAVERSION=\"$(EXTRAVERSION)\" -MMD -MP
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe
BIN_CFLAGS := -fPIE -DPIE
LIB_CFLAGS := -fPIC
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index b3f11d4c..bc2d6388 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -66,7 +66,6 @@
#define MAX_DEV_LOSS_TMO UINT_MAX
#define DEFAULT_PIDFILE RUNTIME_DIR "/multipathd.pid"
#define DEFAULT_SOCKET "/org/kernel/linux/storage/multipathd"
-#define DEFAULT_CONFIGFILE "/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE "/etc/multipath/bindings"
#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids"
#define DEFAULT_PRKEYS_FILE "/etc/multipath/prkeys"