Skip to content

Commit

Permalink
bashcomp: Install and package completion scripts.
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yew011 committed Mar 20, 2015
1 parent bb5dbe7 commit 2c9907c
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ OVSIDL_BUILT =
pkgdata_DATA =
sbin_SCRIPTS =
scripts_SCRIPTS =
completion_SCRIPTS =
scripts_DATA =
SUFFIXES =
check_DATA =
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,
Expand Down
1 change: 1 addition & 0 deletions debian/openvswitch-common.install
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
etc/bash_completion.d/ovs-appctl-bashcomp.bash
usr/bin/ovs-appctl
usr/bin/ovs-benchmark
usr/bin/ovs-docker
Expand Down
1 change: 1 addition & 0 deletions debian/openvswitch-switch.install
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions rhel/openvswitch.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions utilities/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions utilities/ovs-command-bashcomp.INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
-----
Expand Down
2 changes: 2 additions & 0 deletions xenserver/openvswitch-xen.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2c9907c

Please sign in to comment.