From b85106a10a78e4c15303ac3b9b16d03a3f2f9cab Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 19 Jan 2011 04:35:46 +0000 Subject: move user scripts ('#!' and runcmd) to be per-instance (LP: #675711) Previously, if you ran an instance with either runcmd data or user-data scripts, it would run again after rebundle or create-image. This puts the files created by runcmd or user-data scripts into instance-id specific paths, and then runs them by that instance-id specific path. LP: #675711 --- upstart/cloud-run-user-script.conf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'upstart/cloud-run-user-script.conf') diff --git a/upstart/cloud-run-user-script.conf b/upstart/cloud-run-user-script.conf index e50006d4..9a47e57b 100644 --- a/upstart/cloud-run-user-script.conf +++ b/upstart/cloud-run-user-script.conf @@ -7,8 +7,10 @@ console output task script -sdir=/var/lib/cloud/data/scripts -[ -d "$sdir" ] || exit 0 -exec cloud-init-run-module once-per-instance user-scripts execute \ - run-parts --regex '.*' "$sdir" +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 end script -- cgit v1.2.3