From f1df97c5b714bea0b321c7f1420dd3c4a2e56ba4 Mon Sep 17 00:00:00 2001 From: Martin Berghaus Date: Mon, 10 Mar 2025 20:01:53 +0100 Subject: [PATCH] added printCisRoot.sh to offer a standard way to get this info. --- core/printCisRoot.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 core/printCisRoot.sh diff --git a/core/printCisRoot.sh b/core/printCisRoot.sh new file mode 100755 index 0000000..456018e --- /dev/null +++ b/core/printCisRoot.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +_SCRIPT="$(readlink -f "${0}" 2> /dev/null)" +_SCRIPT_FOLDER="$(dirname ${_SCRIPT:?"Missing SCRIPT"} 2> /dev/null)/" +_CIS_ROOT="$(dirname ${_SCRIPT_FOLDER:?"Missing SCRIPT_FOLDER"} 2> /dev/null)/" + +[ -d "${_CIS_ROOT}" ] \ + && [ -d "${_CIS_ROOT}definitions/" ] \ + && [ -d "${_CIS_ROOT}states/" ] \ + && echo "${_CIS_ROOT}" \ + && exit 0 + +echo "FAIL: Unable to detect CIS_ROOT" >&2 +exit 1