commit:     bc9d9ec1d7cc6584b61762649259265f37b56885
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 22 07:45:08 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Oct 22 08:39:11 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bc9d9ec1

app-emulation/lxc: rework bash-completion logic in 4.0.11

 - since it collides with lxd's bash-completion file.

Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 app-emulation/lxc/lxc-4.0.11.ebuild | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/app-emulation/lxc/lxc-4.0.11.ebuild 
b/app-emulation/lxc/lxc-4.0.11.ebuild
index 4af531d3e74..65cb5e5ee84 100644
--- a/app-emulation/lxc/lxc-4.0.11.ebuild
+++ b/app-emulation/lxc/lxc-4.0.11.ebuild
@@ -134,9 +134,16 @@ src_configure() {
 src_install() {
        default
 
-       mkdir -p "${ED}"/$(get_bashcompdir) || die
-       mv "${ED}"/etc/bash_completion.d/* "${ED}"/$(get_bashcompdir)/ || die
-       rmdir  "${ED}"/etc/bash_completion.d/ || die
+       # The main bash-completion file will collide with lxd, need to relocate 
and update symlinks.
+       mkdir -p "${ED}"/$(get_bashcompdir) || die "Failed to create 
bashcompdir."
+       mv "${ED}"/etc/bash_completion.d/lxc 
"${ED}"/$(get_bashcompdir)/lxc-start || die "Failed to relocate lxc 
bash-completion file."
+       rm -r "${ED}"/etc/bash_completion.d || die "Failed to remove wrong 
bash_completion.d content."
+
+       if use tools; then
+               bashcomp_alias lxc-start 
lxc-{attach,cgroup,copy,console,create,destroy,device,execute,freeze,info,monitor,snapshot,stop,unfreeze,wait}
+       else
+               bashcomp_alias lxc-start lxc-usernsexec
+       fi
 
        keepdir /etc/lxc /var/lib/lxc/rootfs /var/log/lxc
        rmdir "${D}"/var/cache/lxc "${D}"/var/cache || die "rmdir failed"

Reply via email to