diff mbox series

[5/6] multipath: udev rules: use configured $(bindir) in udev rules

Message ID 20240205124638.17877-6-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: Mike Snitzer
Headers show
Series multipath-tools: udev rules and service improvements | expand

Commit Message

Martin Wilck Feb. 5, 2024, 12:46 p.m. UTC
This allows us to remove the lumsy MPATH_SBIN_PATH property and
related tests.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 .gitignore                                            | 1 +
 Makefile.inc                                          | 2 +-
 multipath/{11-dm-mpath.rules => 11-dm-mpath.rules.in} | 5 +----
 multipath/Makefile                                    | 2 +-
 multipath/multipath.rules.in                          | 5 +----
 5 files changed, 5 insertions(+), 10 deletions(-)
 rename multipath/{11-dm-mpath.rules => 11-dm-mpath.rules.in} (97%)

Comments

Benjamin Marzinski Feb. 9, 2024, 1:04 a.m. UTC | #1
On Mon, Feb 05, 2024 at 01:46:37PM +0100, Martin Wilck wrote:
> This allows us to remove the lumsy MPATH_SBIN_PATH property and
> related tests.
> 
> Signed-off-by: Martin Wilck <mwilck@suse.com>

Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  .gitignore                                            | 1 +
>  Makefile.inc                                          | 2 +-
>  multipath/{11-dm-mpath.rules => 11-dm-mpath.rules.in} | 5 +----
>  multipath/Makefile                                    | 2 +-
>  multipath/multipath.rules.in                          | 5 +----
>  5 files changed, 5 insertions(+), 10 deletions(-)
>  rename multipath/{11-dm-mpath.rules => 11-dm-mpath.rules.in} (97%)
> 
> diff --git a/.gitignore b/.gitignore
> index 6890e4a..049ffe8 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -16,6 +16,7 @@ multipath/multipath
>  multipath/multipath.8
>  multipath/multipath.conf.5
>  multipath/multipath.rules
> +multipath/11-dm-mpath.rules
>  multipath/tmpfiles.conf
>  multipathd/multipathd
>  multipathd/multipathd.8
> diff --git a/Makefile.inc b/Makefile.inc
> index 06bdd5e..3bcc7c2 100644
> --- a/Makefile.inc
> +++ b/Makefile.inc
> @@ -148,4 +148,4 @@ NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
>  
>  %:	%.in
>  	@echo creating $@
> -	$(Q)sed 's:@CONFIGFILE@:'$(configfile)':g;s:@CONFIGDIR@:'$(configdir)':g;s:@STATE_DIR@:'$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g' $< >$@
> +	$(Q)sed 's:@CONFIGFILE@:'$(configfile)':g;s:@CONFIGDIR@:'$(configdir)':g;s:@STATE_DIR@:'$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g;s:@BINDIR@:'$(bindir)':g' $< >$@
> diff --git a/multipath/11-dm-mpath.rules b/multipath/11-dm-mpath.rules.in
> similarity index 97%
> rename from multipath/11-dm-mpath.rules
> rename to multipath/11-dm-mpath.rules.in
> index 2706809..38a0132 100644
> --- a/multipath/11-dm-mpath.rules
> +++ b/multipath/11-dm-mpath.rules.in
> @@ -35,16 +35,13 @@ ENV{DM_SUBSYSTEM_UDEV_FLAG2}=="1", ENV{MPATH_DEVICE_READY}="0", \
>  # This may not be reliable, as events aren't necessarily received in order.
>  ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
>  
> -ENV{MPATH_SBIN_PATH}="/sbin"
> -TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
> -
>  # Don't run multipath -U during "coldplug" after switching root,
>  # because paths are just being added to the udev db.
>  ACTION=="add", ENV{.MPATH_DEVICE_READY_OLD}=="1", GOTO="paths_ok"
>  
>  # Check the map state directly with multipath -U.
>  # This doesn't attempt I/O on the device.
> -PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -U -v1 %k", GOTO="paths_ok"
> +PROGRAM=="@BINDIR@/multipath -U -v1 %k", GOTO="paths_ok"
>  ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
>  LABEL="paths_ok"
>  
> diff --git a/multipath/Makefile b/multipath/Makefile
> index 0efb9b2..f8c1f5e 100644
> --- a/multipath/Makefile
> +++ b/multipath/Makefile
> @@ -5,7 +5,7 @@ include ../Makefile.inc
>  
>  EXEC      := multipath
>  MANPAGES  := multipath.8 multipath.conf.5
> -GENERATED := $(MANPAGES) multipath.rules tmpfiles.conf
> +GENERATED := $(MANPAGES) multipath.rules tmpfiles.conf 11-dm-mpath.rules
>  
>  CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir)
>  CFLAGS += $(BIN_CFLAGS)
> diff --git a/multipath/multipath.rules.in b/multipath/multipath.rules.in
> index 03fa4d7..780bf85 100644
> --- a/multipath/multipath.rules.in
> +++ b/multipath/multipath.rules.in
> @@ -18,9 +18,6 @@ GOTO="end_mpath"
>  
>  LABEL="test_dev"
>  
> -ENV{MPATH_SBIN_PATH}="/sbin"
> -TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
> -
>  # FIND_MULTIPATHS_WAIT_UNTIL is the timeout (in seconds after the
>  # epoch).
>  IMPORT{db}="FIND_MULTIPATHS_WAIT_UNTIL"
> @@ -31,7 +28,7 @@ IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
>  
>  # multipath -u sets DM_MULTIPATH_DEVICE_PATH and,
>  # if "find_multipaths smart", also FIND_MULTIPATHS_WAIT_UNTIL.
> -IMPORT{program}=="$env{MPATH_SBIN_PATH}/multipath -u %k", \
> +IMPORT{program}=="@BINDIR@/multipath -u %k", \
>  	ENV{.MPATH_CHECK_PASSED}="1"
>  
>  # case 1: this is definitely multipath
> -- 
> 2.43.0
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index 6890e4a..049ffe8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,7 @@  multipath/multipath
 multipath/multipath.8
 multipath/multipath.conf.5
 multipath/multipath.rules
+multipath/11-dm-mpath.rules
 multipath/tmpfiles.conf
 multipathd/multipathd
 multipathd/multipathd.8
diff --git a/Makefile.inc b/Makefile.inc
index 06bdd5e..3bcc7c2 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -148,4 +148,4 @@  NV_VERSION_SCRIPT = $(DEVLIB:%.so=%-nv.version)
 
 %:	%.in
 	@echo creating $@
-	$(Q)sed 's:@CONFIGFILE@:'$(configfile)':g;s:@CONFIGDIR@:'$(configdir)':g;s:@STATE_DIR@:'$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g' $< >$@
+	$(Q)sed 's:@CONFIGFILE@:'$(configfile)':g;s:@CONFIGDIR@:'$(configdir)':g;s:@STATE_DIR@:'$(statedir)':g;s:@RUNTIME_DIR@:'$(runtimedir)':g;s/@MODPROBE_UNIT@/'$(MODPROBE_UNIT)'/g;s:@BINDIR@:'$(bindir)':g' $< >$@
diff --git a/multipath/11-dm-mpath.rules b/multipath/11-dm-mpath.rules.in
similarity index 97%
rename from multipath/11-dm-mpath.rules
rename to multipath/11-dm-mpath.rules.in
index 2706809..38a0132 100644
--- a/multipath/11-dm-mpath.rules
+++ b/multipath/11-dm-mpath.rules.in
@@ -35,16 +35,13 @@  ENV{DM_SUBSYSTEM_UDEV_FLAG2}=="1", ENV{MPATH_DEVICE_READY}="0", \
 # This may not be reliable, as events aren't necessarily received in order.
 ENV{DM_NR_VALID_PATHS}=="0", ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
 
-ENV{MPATH_SBIN_PATH}="/sbin"
-TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
-
 # Don't run multipath -U during "coldplug" after switching root,
 # because paths are just being added to the udev db.
 ACTION=="add", ENV{.MPATH_DEVICE_READY_OLD}=="1", GOTO="paths_ok"
 
 # Check the map state directly with multipath -U.
 # This doesn't attempt I/O on the device.
-PROGRAM=="$env{MPATH_SBIN_PATH}/multipath -U -v1 %k", GOTO="paths_ok"
+PROGRAM=="@BINDIR@/multipath -U -v1 %k", GOTO="paths_ok"
 ENV{MPATH_DEVICE_READY}="0", GOTO="mpath_action"
 LABEL="paths_ok"
 
diff --git a/multipath/Makefile b/multipath/Makefile
index 0efb9b2..f8c1f5e 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -5,7 +5,7 @@  include ../Makefile.inc
 
 EXEC      := multipath
 MANPAGES  := multipath.8 multipath.conf.5
-GENERATED := $(MANPAGES) multipath.rules tmpfiles.conf
+GENERATED := $(MANPAGES) multipath.rules tmpfiles.conf 11-dm-mpath.rules
 
 CPPFLAGS += -I$(multipathdir) -I$(mpathutildir) -I$(mpathcmddir)
 CFLAGS += $(BIN_CFLAGS)
diff --git a/multipath/multipath.rules.in b/multipath/multipath.rules.in
index 03fa4d7..780bf85 100644
--- a/multipath/multipath.rules.in
+++ b/multipath/multipath.rules.in
@@ -18,9 +18,6 @@  GOTO="end_mpath"
 
 LABEL="test_dev"
 
-ENV{MPATH_SBIN_PATH}="/sbin"
-TEST!="$env{MPATH_SBIN_PATH}/multipath", ENV{MPATH_SBIN_PATH}="/usr/sbin"
-
 # FIND_MULTIPATHS_WAIT_UNTIL is the timeout (in seconds after the
 # epoch).
 IMPORT{db}="FIND_MULTIPATHS_WAIT_UNTIL"
@@ -31,7 +28,7 @@  IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
 
 # multipath -u sets DM_MULTIPATH_DEVICE_PATH and,
 # if "find_multipaths smart", also FIND_MULTIPATHS_WAIT_UNTIL.
-IMPORT{program}=="$env{MPATH_SBIN_PATH}/multipath -u %k", \
+IMPORT{program}=="@BINDIR@/multipath -u %k", \
 	ENV{.MPATH_CHECK_PASSED}="1"
 
 # case 1: this is definitely multipath