summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-07 16:29:58 +0100
committerErich Eckner <git@eckner.net>2018-03-07 16:29:58 +0100
commit98c468dee44e09a27c89019c3d8c584efe0bf1c0 (patch)
tree7bdba85af27eb47c96d7136c71bd508f6da92a4c
parentb90c2a7164a911a0fc30230f2817cbc3a65b4a86 (diff)
downloadbuilder-98c468dee44e09a27c89019c3d8c584efe0bf1c0.tar.xz
bin/strict-bashism-check: do not fail if shellcheck is not available
-rwxr-xr-xbin/strict-bashism-check22
1 files changed, 12 insertions, 10 deletions
diff --git a/bin/strict-bashism-check b/bin/strict-bashism-check
index b1bd3bf..fa073b8 100755
--- a/bin/strict-bashism-check
+++ b/bin/strict-bashism-check
@@ -72,14 +72,16 @@ if [ -n "${errors}" ]; then
exit 1
fi
-errors=$(
- cd "${tmp_dir}" || \
- echo 'Cannot cd.'
- shellcheck -x bin/* conf/* 2>&1
-)
-
-if [ -n "${errors}" ]; then
- >&2 echo 'shellcheck complains about the following:'
- >&2 echo "${errors}"
- exit 1
+if which shellcheck >/dev/null 2>&1; then
+ errors=$(
+ cd "${tmp_dir}" || \
+ echo 'Cannot cd.'
+ shellcheck -x bin/* conf/* 2>&1
+ )
+
+ if [ -n "${errors}" ]; then
+ >&2 echo 'shellcheck complains about the following:'
+ >&2 echo "${errors}"
+ exit 1
+ fi
fi