]>
Commit | Line | Data |
---|---|---|
5ae7ae8a KZ |
1 | #!/bin/bash |
2 | ||
3 | # | |
4 | # This script checks if we have bash-completion scripts for the all compiled | |
5 | # binaries. | |
6 | # | |
7 | # Copyright (C) 2016 Karel Zak <kzak@redhat.com> | |
8 | # | |
9 | ||
10 | ||
11 | die() { | |
12 | echo "error: $1" | |
13 | exit 1 | |
14 | } | |
15 | ||
16 | usage() { | |
17 | echo "Usage:" | |
18 | echo " $0 [<top_srcdir>]" | |
19 | } | |
20 | ||
21 | # unwanted scripts -- use grep -E, e.g. (aaa|bbb|ccc) | |
22 | completion_exclude="(nologin)" | |
23 | ||
24 | top_srcdir=${1-"."} | |
25 | completion_dir="${top_srcdir}/bash-completion" | |
26 | ||
27 | [ -d "${completion_dir}" ] || die "not found ${completion_dir}" | |
28 | ||
29 | bin_files=$(cd ${top_srcdir} && find * -maxdepth 0 -perm /u+x \ | |
30 | \! -type d \ | |
31 | \! -name \*.sh \! -name \*.cache \! -name \*.status \ | |
32 | \! -name configure \! -name libtool | sort) | |
33 | ||
34 | completion_files=$(cd ${completion_dir}/ && find * ! -name '*.am' | sort -u) | |
35 | completion_missing=$(comm -3 <(echo "$completion_files") <(echo "$bin_files")) | |
36 | ||
37 | if [ -n "$completion_missing" -a -n "$completion_exclude" ]; then | |
38 | completion_missing=$(echo "$completion_missing" | grep -v -E "$completion_exclude") | |
39 | fi | |
40 | ||
41 | if [ -n "$completion_missing" ]; then | |
42 | echo "Missing completion scripts:" | |
43 | echo "$completion_missing" | |
44 | fi | |
45 |