summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Wang <alexw@nicira.com>2015-03-18 14:32:23 -0700
committerAlex Wang <alexw@nicira.com>2015-03-20 16:42:47 -0700
commit2c9907cde3be90e12efb3c2729c0a8e98e898a2d (patch)
treeb07cd453a9edfe4192c2e9d6d666facdd64c83f2
parentbb5dbe78592b3f39f0e7e6361c8796a5023363e5 (diff)
downloadopenvswitch-2c9907cde3be90e12efb3c2729c0a8e98e898a2d.tar.gz
bashcomp: Install and package completion scripts.
This commit makes the bash completion scripts be installed to $(sysconfdir)/bash_completion.d/ through 'make install' and to /etc/bash_completion.d/ through package installation. This will make the scripts available for each bash session. An alternative is to put scripts to /usr/share/bash_completion/ directory. However, this is not supported by earlier version of bash completion. Signed-off-by: Alex Wang <alexw@nicira.com>
-rw-r--r--Makefile.am2
-rw-r--r--debian/openvswitch-common.install1
-rw-r--r--debian/openvswitch-switch.install1
-rw-r--r--rhel/openvswitch.spec.in2
-rw-r--r--utilities/automake.mk4
-rw-r--r--utilities/ovs-command-bashcomp.INSTALL.md13
-rw-r--r--xenserver/openvswitch-xen.spec.in2
7 files changed, 22 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index e1a4e1780..ab2216749 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -137,6 +137,7 @@ OVSIDL_BUILT =
pkgdata_DATA =
sbin_SCRIPTS =
scripts_SCRIPTS =
+completion_SCRIPTS =
scripts_DATA =
SUFFIXES =
check_DATA =
@@ -144,6 +145,7 @@ check_SCRIPTS =
pkgconfig_DATA =
scriptsdir = $(pkgdatadir)/scripts
+completiondir = $(sysconfdir)/bash_completion.d
pkgconfigdir = $(libdir)/pkgconfig
# This ensures that files added to EXTRA_DIST are always distributed,
diff --git a/debian/openvswitch-common.install b/debian/openvswitch-common.install
index 11bb59670..f0841529a 100644
--- a/debian/openvswitch-common.install
+++ b/debian/openvswitch-common.install
@@ -1,3 +1,4 @@
+etc/bash_completion.d/ovs-appctl-bashcomp.bash
usr/bin/ovs-appctl
usr/bin/ovs-benchmark
usr/bin/ovs-docker
diff --git a/debian/openvswitch-switch.install b/debian/openvswitch-switch.install
index c4f1426fe..b5d006321 100644
--- a/debian/openvswitch-switch.install
+++ b/debian/openvswitch-switch.install
@@ -1,3 +1,4 @@
+etc/bash_completion.d/ovs-vsctl-bashcomp.bash
usr/bin/ovs-dpctl
usr/bin/ovs-dpctl-top
usr/bin/ovs-pcap
diff --git a/rhel/openvswitch.spec.in b/rhel/openvswitch.spec.in
index 56603ccbb..1ea685d3b 100644
--- a/rhel/openvswitch.spec.in
+++ b/rhel/openvswitch.spec.in
@@ -123,6 +123,8 @@ exit 0
%files
%defattr(-,root,root)
+/etc/bash_completion.d/ovs-appctl-bashcomp.bash
+/etc/bash_completion.d/ovs-vsctl-bashcomp.bash
/etc/init.d/openvswitch
%config(noreplace) /etc/logrotate.d/openvswitch
/etc/sysconfig/network-scripts/ifup-ovs
diff --git a/utilities/automake.mk b/utilities/automake.mk
index 8b55e2d5d..a06630f1f 100644
--- a/utilities/automake.mk
+++ b/utilities/automake.mk
@@ -22,6 +22,10 @@ scripts_SCRIPTS += \
utilities/ovs-save
scripts_DATA += utilities/ovs-lib
+completion_SCRIPTS += \
+ utilities/ovs-appctl-bashcomp.bash \
+ utilities/ovs-vsctl-bashcomp.bash
+
check_SCRIPTS += \
utilities/ovs-appctl-bashcomp.bash \
utilities/ovs-vsctl-bashcomp.bash
diff --git a/utilities/ovs-command-bashcomp.INSTALL.md b/utilities/ovs-command-bashcomp.INSTALL.md
index 411f42fe6..9bdef40f3 100644
--- a/utilities/ovs-command-bashcomp.INSTALL.md
+++ b/utilities/ovs-command-bashcomp.INSTALL.md
@@ -65,9 +65,16 @@ ovs-vsctl-bashcomp
How to use:
-----------
- To use the scripts, either copy them inside /etc/bash_completion.d/ or
- manually run it directly in bash via . ovs-appctl-bashcomp.bash or
- . ovs-vsctl-bashcomp.bash.
+ The bashcomp scripts should be placed at /etc/bash_completion.d/
+ to be available for all bash sessions. Running 'make install'
+ will place the scripts to $(sysconfdir)/bash_completion.d/. So user
+ should specify --sysconfdir=/etc at configuration. Meanwhile, if OVS is
+ installed from packages, the scripts will automatically be placed inside
+ /etc/bash_completion.d/.
+
+ If you just want to run the scripts in one bash, you can remove them from
+ /etc/bash_completion.d/ and run the scripts via '. ovs-appctl-bashcomp.bash'
+ or '. ovs-vsctl-bashcomp.bash'.
Test:
-----
diff --git a/xenserver/openvswitch-xen.spec.in b/xenserver/openvswitch-xen.spec.in
index 3bae86a51..4d98d2e01 100644
--- a/xenserver/openvswitch-xen.spec.in
+++ b/xenserver/openvswitch-xen.spec.in
@@ -430,6 +430,8 @@ exit 0
%files
%defattr(-,root,root)
+/etc/bash_completion.d/ovs-appctl-bashcomp.bash
+/etc/bash_completion.d/ovs-vsctl-bashcomp.bash
/etc/init.d/openvswitch
/etc/init.d/openvswitch-xapi-update
/etc/xapi.d/plugins/openvswitch-cfg-update