summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--upstart/cloud-run-user-script.conf24
1 files changed, 18 insertions, 6 deletions
diff --git a/upstart/cloud-run-user-script.conf b/upstart/cloud-run-user-script.conf
index 9a47e57b..e845aa71 100644
--- a/upstart/cloud-run-user-script.conf
+++ b/upstart/cloud-run-user-script.conf
@@ -7,10 +7,22 @@ console output
task
script
-iid=$(cloud-init-query instance-id) || exit 1
-sdir="/var/lib/cloud/data/scripts/${iid}"
-if [ -d "$sdir" ]; then
- exec cloud-init-run-module once-per-instance user-scripts execute \
- run-parts --regex '.*' "$sdir"
-fi
+bd=/var/lib/cloud
+toks="
+ ${bd}/scripts/per-once:once:cloud-scripts-per-once
+ ${bd}/scripts/per-boot:always:cloud-scripts-per-boot
+ ${bd}/scripts/per-instance:once-per-instance:cloud-scripts-per-instance
+ ${bd}/instance/scripts:once-per-instance:user-scripts
+"
+oifs=${IFS}
+errors=""
+for tok in ${toks}; do
+ IFS=":"; set -- ${tok}; IFS=${oifs}
+ dir=${1}; per=${2}; name=${3}
+ [ -d "${dir}" ] || continue
+ cloud-init-run-module "${per}" "${name}" execute \
+ run-parts --regex '.*' "$dir" || errors="${errors} ${name}"
+done
+errors=${errors# }
+[ -z "${errors}" ] || { echo "errors executing ${errors}" 1>&2; exit 1; }
end script