summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorKarel Zak2016-03-17 14:34:29 +0100
committerKarel Zak2016-03-17 14:34:29 +0100
commit5ae7ae8adbfba3c12f4d2e529251d582e9877ed2 (patch)
tree7fcd3a4f964b060116944de5ad351fe8d96ba741 /tools
parenttests: ignore setarch on sparc (diff)
downloadkernel-qcow2-util-linux-5ae7ae8adbfba3c12f4d2e529251d582e9877ed2.tar.gz
kernel-qcow2-util-linux-5ae7ae8adbfba3c12f4d2e529251d582e9877ed2.tar.xz
kernel-qcow2-util-linux-5ae7ae8adbfba3c12f4d2e529251d582e9877ed2.zip
tools: add missing checkcompletion.sh
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/checkcompletion.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/tools/checkcompletion.sh b/tools/checkcompletion.sh
new file mode 100755
index 000000000..f3fdda486
--- /dev/null
+++ b/tools/checkcompletion.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+
+#
+# This script checks if we have bash-completion scripts for the all compiled
+# binaries.
+#
+# Copyright (C) 2016 Karel Zak <kzak@redhat.com>
+#
+
+
+die() {
+ echo "error: $1"
+ exit 1
+}
+
+usage() {
+ echo "Usage:"
+ echo " $0 [<top_srcdir>]"
+}
+
+# unwanted scripts -- use grep -E, e.g. (aaa|bbb|ccc)
+completion_exclude="(nologin)"
+
+top_srcdir=${1-"."}
+completion_dir="${top_srcdir}/bash-completion"
+
+[ -d "${completion_dir}" ] || die "not found ${completion_dir}"
+
+bin_files=$(cd ${top_srcdir} && find * -maxdepth 0 -perm /u+x \
+ \! -type d \
+ \! -name \*.sh \! -name \*.cache \! -name \*.status \
+ \! -name configure \! -name libtool | sort)
+
+completion_files=$(cd ${completion_dir}/ && find * ! -name '*.am' | sort -u)
+completion_missing=$(comm -3 <(echo "$completion_files") <(echo "$bin_files"))
+
+if [ -n "$completion_missing" -a -n "$completion_exclude" ]; then
+ completion_missing=$(echo "$completion_missing" | grep -v -E "$completion_exclude")
+fi
+
+if [ -n "$completion_missing" ]; then
+ echo "Missing completion scripts:"
+ echo "$completion_missing"
+fi
+