From d07921eca5923d1a89947c895d6e0ecf69872e90 Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Fri, 27 Sep 2013 09:42:51 -0700 Subject: [PATCH] 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 --- README.md | 9 ++++++--- lib/common-functions | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d1dc0c4f4..df0f831bd 100644 --- a/README.md +++ b/README.md @@ -260,15 +260,18 @@ part of the process you need to customise: to disable unneeded services and clean the cache left by the package 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 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. +* 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: * binary-deps.d : text files listing executables required to be fed into the diff --git a/lib/common-functions b/lib/common-functions index d75999215..8ac09e684 100644 --- a/lib/common-functions +++ b/lib/common-functions @@ -54,11 +54,43 @@ function save_image () { 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 () { mkdir -p $TMP_HOOKS_PATH for _ELEMENT in $IMAGE_ELEMENT ; 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/* ; break done