/usr/bin/dh_bash-completion is in bash-completion 1:2.8-1ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #!/usr/bin/perl -w
=head1 NAME
dh_bash-completion - install bash completions for package
=cut
use strict;
use File::Find;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
B<dh_bash-completion> [S<I<debhelper options>>]
=head1 DESCRIPTION
dh_bash-completion is a debhelper program that is responsible for installing
completions for bash, usable installing the "bash-completion" package.
If a file named debian/package.bash-completion exists, then different actions
are performed, depending on its format.
It can be a proper completion snippet, and in that case it would be installed
in the completion directory, and no other actions would be performed.
It can also be a list of files, with an optionally specified name to call the
completion snippet after. The file format is as follows:
my/path/to/foo-completion # this would be installed as "foo-completion"
my/path/to/bar-completion baz # this would be installed as "baz"
=cut
init();
my $srcdir = '.';
$srcdir = $dh{SOURCEDIR}."/" if defined $dh{SOURCEDIR};
PKG: foreach my $package (@{$dh{DOPACKAGES}}) {
next if is_udeb($package);
my $tmp = tmpdir($package);
my $bc_dir = "$tmp/usr/share/bash-completion/completions";
my $completions = pkgfile($package,"bash-completion");
my @install;
my $name;
if ($completions) {
if (! -d "$bc_dir") {
doit("install", "-d", "$bc_dir");
}
# try parsing a list of files
@install = filedoublearray($completions);
foreach my $set (@install) {
my @filelist;
my @tmp = @$set;
if (@$set > 1) {
$name = pop @$set;
}
else {
$name = basename($tmp[0]);
}
verbose_print "installing $tmp[0] as $name";
my @found;
foreach my $glob (@$set) {
@found = glob "$srcdir/$glob";
if (!compat(6)) {
# Fall back to looking into debian/tmp
if (!@found || !-e $found[0]) {
@found = glob "debian/tmp/$glob";
}
}
if (!@found || !-e $found[0]) {
warning "file-list parsing failed, installing as proper snippet";
doit("install", "-p", "-m644", $completions, "$bc_dir/$package");
next PKG
}
push @filelist, @found;
}
if (! compat(4)) { # check added in v5
# glob now, relative to srcdir
if (!@filelist) {
error("$package missing files (@$set), aborting");
}
}
foreach my $src (@filelist) {
doit("install", "-p", "-m644", $src, "$bc_dir/$name");
}
}
}
}
=head1 SEE ALSO
L<debhelper(1)>
This program is a part of bash-completion.
L<bash(1)>
=head1 AUTHOR
David Paleino <d.paleino@gmail.com>
=cut
|