Blame SOURCES/0047-ndctl-install-bash-completion-symlinks.patch

26ccd9
From ac46d00d7d4d555a238bb898e2ff4af0c444bebe Mon Sep 17 00:00:00 2001
26ccd9
From: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
Date: Tue, 16 Nov 2021 17:51:31 -0700
26ccd9
Subject: [PATCH 047/217] ndctl: install bash-completion symlinks
26ccd9
26ccd9
Install symlinks for other utilities (daxctl, cxl-cli) in the
26ccd9
completions directory so that the dynamic completion loader can pick up
26ccd9
their respective names. Without this, completions for daxctl and cxl
26ccd9
would only work after a prior invocation of ndctl's completion.
26ccd9
26ccd9
Reported-by: Dan Williams <dan.j.williams@intel.com>
26ccd9
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
26ccd9
---
26ccd9
 Makefile.am   | 3 +++
26ccd9
 configure.ac  | 1 +
26ccd9
 ndctl.spec.in | 4 +++-
26ccd9
 3 files changed, 7 insertions(+), 1 deletion(-)
26ccd9
26ccd9
diff --git a/Makefile.am b/Makefile.am
26ccd9
index fa2010a..bd0037e 100644
26ccd9
--- a/Makefile.am
26ccd9
+++ b/Makefile.am
26ccd9
@@ -49,6 +49,9 @@ sles/ndctl.spec: sles/header ndctl.spec.in Makefile.am version.m4
26ccd9
 if ENABLE_BASH_COMPLETION
26ccd9
 bashcompletiondir = $(BASH_COMPLETION_DIR)
26ccd9
 dist_bashcompletion_DATA = contrib/ndctl
26ccd9
+install-data-hook:
26ccd9
+	$(LN_S) -f $(BASH_COMPLETION_DIR)/ndctl $(DESTDIR)/$(BASH_COMPLETION_DIR)/daxctl
26ccd9
+	$(LN_S) -f $(BASH_COMPLETION_DIR)/ndctl $(DESTDIR)/$(BASH_COMPLETION_DIR)/cxl
26ccd9
 endif
26ccd9
 
26ccd9
 modprobe_file = contrib/nvdimm-security.conf
26ccd9
diff --git a/configure.ac b/configure.ac
26ccd9
index 00497ae..9ac785f 100644
26ccd9
--- a/configure.ac
26ccd9
+++ b/configure.ac
26ccd9
@@ -31,6 +31,7 @@ AC_PREFIX_DEFAULT([/usr])
26ccd9
 
26ccd9
 AC_PROG_SED
26ccd9
 AC_PROG_MKDIR_P
26ccd9
+AC_PROG_LN_S
26ccd9
 
26ccd9
 AC_ARG_ENABLE([docs],
26ccd9
         AS_HELP_STRING([--disable-docs],
26ccd9
diff --git a/ndctl.spec.in b/ndctl.spec.in
26ccd9
index 4b08c05..27ca097 100644
26ccd9
--- a/ndctl.spec.in
26ccd9
+++ b/ndctl.spec.in
26ccd9
@@ -140,7 +140,7 @@ make check
26ccd9
 %license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
26ccd9
 %{_bindir}/ndctl
26ccd9
 %{_mandir}/man1/ndctl*
26ccd9
-%{bashcompdir}/
26ccd9
+%{bashcompdir}/ndctl
26ccd9
 %{_unitdir}/ndctl-monitor.service
26ccd9
 %{_sysconfdir}/ndctl/keys/keys.readme
26ccd9
 %{_sysconfdir}/modprobe.d/nvdimm-security.conf
26ccd9
@@ -153,12 +153,14 @@ make check
26ccd9
 %{_bindir}/daxctl
26ccd9
 %{_mandir}/man1/daxctl*
26ccd9
 %{_datadir}/daxctl/daxctl.conf
26ccd9
+%{bashcompdir}/daxctl
26ccd9
 
26ccd9
 %files -n cxl-cli
26ccd9
 %defattr(-,root,root)
26ccd9
 %license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
26ccd9
 %{_bindir}/cxl
26ccd9
 %{_mandir}/man1/cxl*
26ccd9
+%{bashcompdir}/cxl
26ccd9
 
26ccd9
 %files -n LNAME
26ccd9
 %defattr(-,root,root)
26ccd9
-- 
26ccd9
2.27.0
26ccd9