summaryrefslogtreecommitdiffstats
path: root/autocluster
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2014-07-29 12:56:42 +1000
committerMartin Schwenke <martin@meltin.net>2014-08-12 11:22:13 +1000
commit63146672403dbdf1d8e29a71f047d6221ccbb309 (patch)
tree9399e4f219cf418541ddc6158a2d922654e3d006 /autocluster
parent50e3d5f9e0842e3228fa405832c8234becf05e3a (diff)
downloadautocluster-63146672403dbdf1d8e29a71f047d6221ccbb309.tar.gz
autocluster-63146672403dbdf1d8e29a71f047d6221ccbb309.tar.xz
autocluster-63146672403dbdf1d8e29a71f047d6221ccbb309.zip
Make cluster_setup.sh use generated configuration file
An early step in making cluster_setup.sh independent of autocluster. * autocluster generates cluster_setup.config during base setup * cluster_setup.sh sources this configuration file * cluster_setup.sh sources the per-task scripts * cluster_setup.sh now exits on first error * Replace @@ templates in scripts with variable references Signed-off-by: Martin Schwenke <martin@meltin.net>
Diffstat (limited to 'autocluster')
-rwxr-xr-xautocluster28
1 files changed, 28 insertions, 0 deletions
diff --git a/autocluster b/autocluster
index 30bce13..2d8a8af 100755
--- a/autocluster
+++ b/autocluster
@@ -1008,6 +1008,34 @@ EOF
register_hook setup_base_hooks setup_network
+setup_base_cluster_setup_config ()
+{
+ local f
+ {
+ echo "# Generated by autocluster"
+ echo
+ # This is a bit of a hack. Perhaps these script belong
+ # elsewhere, since they no longer have templates?
+ for f in $(find "${BASE_TEMPLATES}/all/root/scripts" -type f |
+ xargs grep -l '^#config:') ; do
+
+ b=$(basename "$f")
+ echo "# $b"
+ local vs v
+ vs=$(sed -n 's@^#config: *@@p' "$f")
+ for v in $vs ; do
+ # This could substitute the values in directly using
+ # ${!v} but then no sanity checking is done to make
+ # sure variables are set.
+ echo "${v}=\"@@${v}@@\""
+ done
+ echo
+ done
+ } | diskimage substitute_vars - "/root/scripts/cluster_setup.config"
+}
+
+register_hook setup_base_hooks setup_base_cluster_setup_config
+
setup_timezone() {
[ -z "$TIMEZONE" ] && {
[ -r /etc/timezone ] && {