From: Daniel Wagner Date: Wed, 16 Mar 2022 10:47:46 +0000 (+0100) Subject: nvmf-autoconnect: Add option to specify path to systemctl X-Git-Tag: v2.0-rc7~14^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=12c0c72f19f40067036bb49398be3dab2f29d302;p=users%2Fsagi%2Fnvme-cli.git nvmf-autoconnect: Add option to specify path to systemctl 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 --- diff --git a/meson.build b/meson.build index 84b07c36..2e22d121 100644 --- a/meson.build +++ b/meson.build @@ -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', diff --git a/meson_options.txt b/meson_options.txt index b7f1840b..224faaee 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -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') diff --git a/nvmf-autoconnect/udev-rules/70-nvmf-autoconnect.rules.in b/nvmf-autoconnect/udev-rules/70-nvmf-autoconnect.rules.in index cbbebc56..434cc080 100644 --- a/nvmf-autoconnect/udev-rules/70-nvmf-autoconnect.rules.in +++ b/nvmf-autoconnect/udev-rules/70-nvmf-autoconnect.rules.in @@ -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"