summaryrefslogtreecommitdiff
path: root/test/conftest
diff options
context:
space:
mode:
Diffstat (limited to 'test/conftest')
-rwxr-xr-xtest/conftest37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/conftest b/test/conftest
new file mode 100755
index 0000000..e202e87
--- /dev/null
+++ b/test/conftest
@@ -0,0 +1,37 @@
1#!/bin/sh
2
3CONFIG_DIR=./configs
4CONFIGS=`/usr/bin/find ${CONFIG_DIR} -type f -exec /usr/bin/grep -v -e ^\# -e ^$ {} \; -exec /bin/echo [] \; 2> /dev/null`
5
6parse_lines() {
7 unset in_sect
8 while read line; do
9 case ${line## } in
10 \[*\]) v="${line#*[}"; v="${v%%]*}"
11 case $select in
12 ${v}) echo Starting our section "${select}" >&2
13 in_sect=true
14 ;;
15 *) [ "${in_sect}" ] && echo Ending our section "${select}" >&2
16 echo Start other section "${v}" >&2
17 unset in_sect
18 ;;
19 esac
20 ;;
21 env.*) echo "### ${line} ### ${in_sect} ###" >&2
22 [ "${in_sect}" ] || continue
23 echo Setting environment: ${line#*env.} >&2
24 _pref=${line#*env.}; _suf=${_pref#* }
25 printf "%s " ${_pref%% *}=\'${_suf}\'
26 ;;
27 *) echo Ignoring ${line} >&2
28 ;;
29 esac
30 done
31}
32
33select=blubber
34_env=$( printf "%s\n" "${CONFIGS}" | parse_lines )
35
36printf "%s\n" "${_env}"
37eval env ${_env} printenv