Deprecate first-boot.d

Print a message and pause the build for 10 seconds to ensure interactive
users see the message.

Fixes bug #1212080

Change-Id: Ia388a54892c479e428b0ed7b8c70d64d65010e21
This commit is contained in:
Clint Byrum 2013-09-27 09:42:51 -07:00
parent f120e122bc
commit d07921eca5
2 changed files with 39 additions and 4 deletions

View File

@ -260,15 +260,18 @@ part of the process you need to customise:
to disable unneeded services and clean the cache left by the package to disable unneeded services and clean the cache left by the package
manager to reduce the size of the image. manager to reduce the size of the image.
* 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 * environment.d: Bash script snippets that are sourced before running scripts
in each phase. Use this to set an environment variable for other hooks. 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 * 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. be added to the list of elements built into the image at image creation time.
* first-boot.d: **DEPRECATED** Runs inside the image before
rc.local. Scripts from here are good for doing per-instance
configuration based on cloud metadata. **This will be removed in a
future release of diskimage-builder. The os-refresh-config element in
tripleo-image-elements is recommended as a replacement.**
Ramdisk elements support the following files in their element directories: Ramdisk elements support the following files in their element directories:
* binary-deps.d : text files listing executables required to be fed into the * binary-deps.d : text files listing executables required to be fed into the

View File

@ -54,11 +54,43 @@ function save_image () {
echo "Image file $1 created..." echo "Image file $1 created..."
} }
function element_pre_check() {
local element_dir=$1
[ -d $element_dir ] || return 1
if [ -d $element_dir/first-boot.d ] ; then
first_boot_deprecated_message $element_dir
fi
}
_DISPLAYED_FIRST_BOOT_DEPRECATED=0
function first_boot_deprecated_message() {
local element_dir=$1
echo "WARNING: first-boot.d found in $element_dir"
if [ $_DISPLAYED_FIRST_BOOT_DEPRECATED -eq 1 ] ; then
return
fi
echo "***********************************************************"
echo "* *"
echo "* *"
echo "* *"
echo "* *"
echo "* WARNING: first-boot.d is DEPRECATED, it will be removed *"
echo "* from diskimage-builder in a future release. *"
echo "* *"
echo "* *"
echo "* *"
echo "* *"
echo "***********************************************************"
echo Pausing 10 seconds....
sleep 10
_DISPLAYED_FIRST_BOOT_DEPRECATED=1
}
function generate_hooks () { function generate_hooks () {
mkdir -p $TMP_HOOKS_PATH mkdir -p $TMP_HOOKS_PATH
for _ELEMENT in $IMAGE_ELEMENT ; do for _ELEMENT in $IMAGE_ELEMENT ; do
for dir in $(echo $ELEMENTS_PATH | tr ":" " ") ; do for dir in $(echo $ELEMENTS_PATH | tr ":" " ") ; do
[ -d $dir/$_ELEMENT ] || continue element_pre_check $dir/$_ELEMENT || continue
cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ; cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ;
break break
done done