From dee1a2eecc9a2355d1818205292e403143fc0554 Mon Sep 17 00:00:00 2001 From: John Hood Date: Tue, 23 Jun 2015 23:40:40 -0400 Subject: [PATCH] Improve Debian bash-completion support * Autoconf queries pkgconf for bash-completion dir-- resolves lintian's `package-install-into-obsolete-dir` diagnostic * Use improved completion snippet from * Remove old /etc/bash_completion.d/mosh "conffile" with dh-maintscript + dpkg-maintscript-helper Closes #628. Signed-off-by: John Hood --- conf/Makefile.am | 4 +++- conf/bash-completion/completions/mosh | 9 +++++++++ conf/bash_completion.d/mosh | 1 - configure.ac | 7 +++++++ debian/control | 3 ++- debian/mosh.maintscript | 1 + 6 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 conf/bash-completion/completions/mosh delete mode 100644 conf/bash_completion.d/mosh create mode 100644 debian/mosh.maintscript diff --git a/conf/Makefile.am b/conf/Makefile.am index cb45ecd..767f21a 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -1,3 +1,5 @@ +completionsdir = @completions@ +dist_completions_DATA = nobase_dist_sysconf_DATA = if INSTALL_UFW @@ -5,5 +7,5 @@ if INSTALL_UFW endif if INSTALL_COMPLETION - nobase_dist_sysconf_DATA += bash_completion.d/mosh + dist_completions_DATA += bash-completion/completions/mosh endif diff --git a/conf/bash-completion/completions/mosh b/conf/bash-completion/completions/mosh new file mode 100644 index 0000000..e928112 --- /dev/null +++ b/conf/bash-completion/completions/mosh @@ -0,0 +1,9 @@ +_mosh () { + local cur prev + + _init_completion || return + + _known_hosts_real -a "$cur" +} + +complete -F _mosh mosh diff --git a/conf/bash_completion.d/mosh b/conf/bash_completion.d/mosh deleted file mode 100644 index 93768d3..0000000 --- a/conf/bash_completion.d/mosh +++ /dev/null @@ -1 +0,0 @@ -complete -F _known_hosts mosh diff --git a/configure.ac b/configure.ac index 01c57cb..9622579 100644 --- a/configure.ac +++ b/configure.ac @@ -369,6 +369,13 @@ AC_CHECK_DECL([IUTF8], # Checks for protobuf PKG_CHECK_MODULES([protobuf], [protobuf]) +# Bash completion needs to ask where it goes if >= 2.0 is installed. +AS_IF([test "$install_completion" != no], + [PKG_CHECK_MODULES([BASH_COMPLETION], [bash-completion >= 2.0], + [completions="`pkg-config --variable=completionsdir bash-completion`"], + [completions="${sysconfdir}/bash-completion.d"]) + AC_SUBST([completions])]) + AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/debian/control b/debian/control index fe645d6..5da4c17 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: mosh Section: net Priority: optional Maintainer: Keith Winstein -Build-Depends: debhelper (>= 7.0.50), autotools-dev, protobuf-compiler, libprotobuf-dev, dh-autoreconf, pkg-config, libutempter-dev, zlib1g-dev, libncurses5-dev, libssl-dev +Build-Depends: debhelper (>= 7.0.50), autotools-dev, protobuf-compiler, libprotobuf-dev, dh-autoreconf, pkg-config, libutempter-dev, zlib1g-dev, libncurses5-dev, libssl-dev, bash-completion Standards-Version: 3.9.6.1 Homepage: http://mosh.mit.edu Vcs-Git: git://github.com/keithw/mosh.git @@ -10,6 +10,7 @@ Vcs-Browser: https://github.com/keithw/mosh Package: mosh Architecture: any +Pre-Depends: dpkg (>= 1.15.7.2) Depends: ${shlibs:Depends}, ${misc:Depends}, openssh-client Recommends: libio-socket-ip-perl Description: Mobile shell that supports roaming and intelligent local echo diff --git a/debian/mosh.maintscript b/debian/mosh.maintscript new file mode 100644 index 0000000..ebd49a3 --- /dev/null +++ b/debian/mosh.maintscript @@ -0,0 +1 @@ +rm_conffile /etc/bash_completion.d/mosh 1.2.5~ -- "$@"