blob: 5b5a45cf16ce49f62bf68569cd1edaac11aa4a3b (
plain)
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
|
#!/bin/sh
CONFIG_DIR=./configs
CONFIGS=`/usr/bin/find ${CONFIG_DIR} -type f -exec /usr/bin/grep -v -e ^\# -e ^$ {} \; -exec /bin/echo [] \; 2> /dev/null`
select=blubber
unset in_sect
while read line; do
case ${line## } in
\[*\]) case [$select in
${line%%]*}) echo Starting our section "${select}" >&2
in_sect=true
;;
*) [ "${in_sect}" ] && echo Ending our section "${select}" >&2
echo Start other section "${line%%]*}" >&2
unset in_sect
;;
esac
;;
env.*) echo "### ${line} ### ${in_sect} ###" >&2
[ "${in_sect}" ] || continue
echo Setting environment: ${line#*env.} >&2
_pref=${line#*env.}; _suf=${_pref#* }
_env="${_env} ${_pref%% *}='${_suf}'"
;;
*) echo Ignoring ${line} >&2
;;
esac
done <<EOF
${CONFIGS}
EOF
printf "%s\n" "${_env}"
eval env ${_env} printenv
|