Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
tools/Makefile.am | 27 ++-------------------------
tools/bash-completion/meson.build | 13 +++++++++++++
tools/meson.build | 4 ++++
3 files changed, 19 insertions(+), 25 deletions(-)
create mode 100644 tools/bash-completion/meson.build
diff --git a/tools/Makefile.am b/tools/Makefile.am
index ba3b0bbc120..9c91cac9ccf 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -23,32 +23,9 @@ STANDALONE_CPPFLAGS = -I$(top_srcdir)
noinst_LTLIBRARIES =
-install-data-local: install-nss \
- install-bash-completion
-
-uninstall-local: uninstall-nss \
- uninstall-bash-completion
-
-if WITH_BASH_COMPLETION
-install-bash-completion:
- $(MKDIR_P) "$(DESTDIR)$(BASH_COMPLETIONS_DIR)"
- $(INSTALL_DATA) $(srcdir)/bash-completion/vsh \
- "$(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh"
- ( cd $(DESTDIR)$(BASH_COMPLETIONS_DIR) && \
- rm -f virsh virt-admin && \
- $(LN_S) vsh virsh && \
- $(LN_S) vsh virt-admin )
-
-uninstall-bash-completion:
- rm -f $(DESTDIR)$(BASH_COMPLETIONS_DIR)/vsh \
- $(DESTDIR)$(BASH_COMPLETIONS_DIR)/virsh \
- $(DESTDIR)$(BASH_COMPLETIONS_DIR)/virt-admin
- rmdir $(DESTDIR)$(BASH_COMPLETIONS_DIR) ||:
-else ! WITH_BASH_COMPLETION
-install-bash-completion:
-uninstall-bash-completion:
-endif ! WITH_BASH_COMPLETION
+install-data-local: install-nss
+uninstall-local: uninstall-nss
if WITH_WIRESHARK_DISSECTOR
diff --git a/tools/bash-completion/meson.build b/tools/bash-completion/meson.build
new file mode 100644
index 00000000000..4cc0892accf
--- /dev/null
+++ b/tools/bash-completion/meson.build
@@ -0,0 +1,13 @@
+install_data('vsh', install_dir: bash_completion_dir)
+
+meson.add_install_script(
+ install_symlink_prog.path(),
+ bash_completion_dir,
+ 'vsh', 'virsh',
+)
+
+meson.add_install_script(
+ install_symlink_prog.path(),
+ bash_completion_dir,
+ 'vsh', 'virt-admin',
+)
diff --git a/tools/meson.build b/tools/meson.build
index ce8f2bdd1e3..36c05d43d9c 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -278,3 +278,7 @@ if init_script == 'systemd'
install_dir: prefix / 'lib' / 'systemd' / 'system',
)
endif
+
+if bash_completion_dep.found()
+ subdir('bash-completion')
+endif
--
2.26.2