Add environment.d hook to setup environment.

Before each phase dib-run-parts will pick these up to setup the
environment for the commands it runs.

Change-Id: I56697d7bc370918d4063eee67a1c35d4988a5359
This commit is contained in:
Clint Byrum 2013-07-09 15:01:33 -07:00
parent 9f93451710
commit 3464064a87
2 changed files with 9 additions and 0 deletions

View File

@ -169,6 +169,9 @@ part of the process you need to customise:
* first-boot.d: Runs inside the image before rc.local. Scripts from here are
good for doing per-instance configuration based on cloud metadata.
* environment.d: Bash script snippets that are sourced before running scripts
in each phase. Use this to set an environment variable for other hooks.
* element-deps : A plain text, newline separated list of elements which will
be added to the list of elements built into the image at image creation time.

View File

@ -49,6 +49,12 @@ targets=$(find $target_dir -type f -executable -printf '%f\n' | grep -E "$allowe
PROFILE_DIR=$(mktemp -d /tmp/profiledir.XXXXXX)
if [ -d /tmp/in_target.d/environment.d ] ; then
for env_file in /tmp/in_target.d/environment.d/* ; do
source $env_file
done
fi
for target in $targets ; do
output "Running $target_dir/$target"
target_tag=${target//\//_}