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

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