]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvmf-autoconnect: Add option to specify path to systemctl
authorDaniel Wagner <dwagner@suse.de>
Wed, 16 Mar 2022 10:47:46 +0000 (11:47 +0100)
committerDaniel Wagner <dwagner@suse.de>
Wed, 16 Mar 2022 10:47:46 +0000 (11:47 +0100)
Many distros have adapted the usr merge and hence systemctl is install
in /usr/bin. Instead just hard coding the new path, let's introduce a
new build option to allow specifying the path to the systemclt
binary.

Note, the scripts also have hard coded paths to /bin/sh or
/bin/echo. None of these paths are covered by POSIX but in practice
all distros have those as symlinks when the usr merge have been
implemented. Let's address these issues when the pop up.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
meson.build
meson_options.txt
nvmf-autoconnect/udev-rules/70-nvmf-autoconnect.rules.in

index 84b07c36dbfc5cba8e620d58dcc5ae64d2579c0f..2e22d12174a6dfb7a3e353d1e4f0f1858b89733e 100644 (file)
@@ -166,6 +166,7 @@ substs.set('REQUIRES', requires)
 substs.set('BINDIR', bindir)
 substs.set('SBINDIR', sbindir)
 substs.set('SYSCONFDIR', sysconfdir)
+substs.set('SYSTEMCTL', get_option('systemctl'))
 
 configure_file(
   input:         'nvme.spec.in',
index b7f1840b8f0d2785b9132fe68abf59df01fc4508..224faaeec058ca24558ae6b76a160a234501cf8b 100644 (file)
@@ -2,6 +2,7 @@ option('udevrulesdir', type : 'string', value : 'etc/udev/rules.d', description
 option('dracutrulesdir', type : 'string', value : 'lib/dracut/dracut.conf.d/', description : 'directory for dracut rules files')
 option('systemddir', type : 'string', value : 'lib/systemd/', description : 'directory for systemd files')
 option('htmldir', type : 'string', value : '', description : 'directory for HTML documentation')
+option('systemctl', type : 'string', value : '/usr/bin/systemctl', description : 'path to systemctl binary')
 
 option('docs', type : 'combo', choices : ['false', 'html', 'man', 'all'], description : 'install documentation')
 option('docs-build', type : 'boolean', value : false,  description : 'build documentation')
index cbbebc56ea80d85cd6609eb30fc17ade902eb0a9..434cc080ffe39ba2dc807465f35e5f26a35906bf 100644 (file)
@@ -11,9 +11,9 @@
 ACTION=="change", SUBSYSTEM=="nvme", ENV{NVME_AEN}=="0x70f002",\
   ENV{NVME_TRTYPE}=="*", ENV{NVME_TRADDR}=="*", \
   ENV{NVME_TRSVCID}=="*", ENV{NVME_HOST_TRADDR}=="*", \
-  RUN+="/bin/systemctl --no-block start nvmf-connect@--device=$kernel\t--transport=$env{NVME_TRTYPE}\t--traddr=$env{NVME_TRADDR}\t--trsvcid=$env{NVME_TRSVCID}\t--host-traddr=$env{NVME_HOST_TRADDR}.service"
+  RUN+="@SYSTEMCTL@ --no-block start nvmf-connect@--device=$kernel\t--transport=$env{NVME_TRTYPE}\t--traddr=$env{NVME_TRADDR}\t--trsvcid=$env{NVME_TRSVCID}\t--host-traddr=$env{NVME_HOST_TRADDR}.service"
 
 # nvme-fc transport generated events (old-style for compatibility)
 ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \
   ENV{NVMEFC_HOST_TRADDR}=="*",  ENV{NVMEFC_TRADDR}=="*", \
-  RUN+="/bin/systemctl --no-block start nvmf-connect@--device=none\t--transport=fc\t--traddr=$env{NVMEFC_TRADDR}\t--trsvcid=none\t--host-traddr=$env{NVMEFC_HOST_TRADDR}.service"
+  RUN+="@SYSTEMCTL@ --no-block start nvmf-connect@--device=none\t--transport=fc\t--traddr=$env{NVMEFC_TRADDR}\t--trsvcid=none\t--host-traddr=$env{NVMEFC_HOST_TRADDR}.service"