diff options
author | Scott Moser <smoser@ubuntu.com> | 2011-01-19 04:35:46 +0000 |
---|---|---|
committer | Scott Moser <smoser@ubuntu.com> | 2011-01-19 04:35:46 +0000 |
commit | b85106a10a78e4c15303ac3b9b16d03a3f2f9cab (patch) | |
tree | 97d3b765b5214c86e30144beee35fe10106282b2 /upstart | |
parent | 548f5b3f81799f3339e66444be58f7016fa8c0a2 (diff) | |
download | vyos-cloud-init-b85106a10a78e4c15303ac3b9b16d03a3f2f9cab.tar.gz vyos-cloud-init-b85106a10a78e4c15303ac3b9b16d03a3f2f9cab.zip |
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
Diffstat (limited to 'upstart')
-rw-r--r-- | upstart/cloud-run-user-script.conf | 10 |
1 files changed, 6 insertions, 4 deletions
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 |