From 1313d6e2056e286508cc9ca62e1473c45b21ef58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20W=C3=B6lzer?= <martin@libclapp.org>
Date: Mon, 16 Sep 2024 21:07:23 +0200
Subject: [PATCH] .ci/check/shellcheck.sh: introduced file

---
 .ci/check/shellcheck.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 .ci/check/shellcheck.sh

diff --git a/.ci/check/shellcheck.sh b/.ci/check/shellcheck.sh
new file mode 100755
index 00000000..c6c15225
--- /dev/null
+++ b/.ci/check/shellcheck.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+if [ -z "${SHELLCHECK_BIN}" ]; then
+    SHELLCHECK_BIN="shellcheck"
+fi
+
+if ! command -v "${SHELLCHECK_BIN}" >/dev/null 2>&1; then
+    echo "ERROR: Binary '${SHELLCHECK_BIN}' does not exist, please set the environment variable SHELLCHECK_BIN to the correct shellcheck version."
+    exit 1
+fi
+
+check_command="${SHELLCHECK_BIN}"
+
+check_script="$(dirname "${BASH_SOURCE[0]}")/check.sh"
+
+files_regex=".*\.sh$"
+
+if ! "${check_script}" --check-command "${check_command}" --files-regex "${files_regex}" "$@"; then
+    echo "ERROR: Executing '${check_script}' failed."
+    exit 1
+fi
-- 
GitLab