-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-opts.sh.inc
46 lines (42 loc) · 1.35 KB
/
config-opts.sh.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# shellcheck disable=SC2148
if ! OPT_GITHUB_ORG_NAME=$(yq '.github-org-name // ""' < "${CONFIG_FILEPATH}"); then
echo "- error: failed to retrieve github-org-name from config"
exit 1
fi
if [ -z "${OPT_GITHUB_ORG_NAME}" ]; then
echo "- error: github-org-name is not defined"
exit 1
fi
if ! OPT_WWW_ROOT_DIR=$(yq '.www-root-dir // ""' < "${CONFIG_FILEPATH}"); then
echo "- error: failed to retrieve www-root-dir from config"
exit 1
fi
if [ -z "${OPT_WWW_ROOT_DIR}" ]; then
echo "- error: www-root-dir is not defined"
exit 1
fi
OPT_WWW_ROOT_DIR="$(realpath "${OPT_WWW_ROOT_DIR}")"
if [ ! -d "${OPT_WWW_ROOT_DIR}" ]; then
echo "- error: ${OPT_WWW_ROOT_DIR} is not existent as well"
exit 1
fi
if ! OPT_REPO_CACHE_DIR=$(yq '.cache-dir // ""' < "${CONFIG_FILEPATH}"); then
echo "- error: failed to retrieve cache-dir from config"
exit 1
fi
if [ -z "${OPT_REPO_CACHE_DIR}" ]; then
echo "- error: cache-dir is not defined"
exit 1
fi
if ! mkdir -p "${OPT_REPO_CACHE_DIR}"; then
echo "- error: failed to ensure cache-dir='${OPT_REPO_CACHE_DIR}' exists"
exit 1
fi
if ! OPT_INDEX_TEMPLATE="$(yq '.index-template // ""' < "${CONFIG_FILEPATH}")"; then
echo "- error: failed to retrieve index-template from config"
exit 1
fi
if [ -z "${OPT_INDEX_TEMPLATE}" ]; then
echo "- error: index-template is empty"
exit 1
fi