Remove first-boot.d support

After being deprecated two releases ago, finally remove any reference
for the support of first-boot.d

Change-Id: I08d67404ef48cad61db3b18fb86e970abfa5d2b6
This commit is contained in:
Ghe Rivero 2014-10-08 07:53:31 +00:00
parent 0f7d9af998
commit 873de01491
8 changed files with 4 additions and 139 deletions

View File

@ -364,13 +364,6 @@ Each element can use the following files to define or affect dependencies:
file and A and C are included when building an image, then B is not used. file and A and C are included when building an image, then B is not used.
### First-boot files ###
* 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 ### ### Ramdisk Elements ###
@ -435,23 +428,12 @@ possible approach to this would be to label elements as either a "driver",
10-user - common Nova user accts 10-user - common Nova user accts
50-my-pack - install packages from my PPA 50-my-pack - install packages from my PPA
60-nova - install nova and some dependencies 60-nova - install nova and some dependencies
first-boot.d/
60-nova - do some post-install config for nova
- In the general case, configuration should probably be handled either by the - In the general case, configuration should probably be handled either by the
meta-data service (eg, during first-boot.d) or via normal CM tools meta-data service (eg, o-r-c) or via normal CM tools
(eg, salt). That being said, it may occasionally be desirable to create a (eg, salt). That being said, it may occasionally be desirable to create a
set of elements which express a distinct configuration of the same software set of elements which express a distinct configuration of the same software
components. For example, if one were to bake a region-specific SSL cert into components.
the images deployed in each region, one might express it like this:
elements/
config-az1/
first-boot.d/
20-ssl - add the az1 certificate
config-az2/
first-boot.d/
20-ssl - add the az2 certificate
In this way, depending on the hardware and in which availability zone it is In this way, depending on the hardware and in which availability zone it is
to be deployed, an image would be composed of: to be deployed, an image would be composed of:
@ -486,8 +468,7 @@ comma-delimited string. Some examples:
* break=before-block-device-size will break before the block device size hooks * break=before-block-device-size will break before the block device size hooks
are called. are called.
* break=after-first-boot,before-pre-install will break after the first-boot * break=before-pre-install will break before the pre-install hooks.
hooks and before the pre-install hooks.
* break=after-error will break after an error during a in target hookpoint. * break=after-error will break after an error during a in target hookpoint.

View File

@ -160,7 +160,6 @@ do_extra_package_install
# Call install scripts to pull in the software users want. # Call install scripts to pull in the software users want.
run_d_in_target install run_d_in_target install
run_d_in_target post-install run_d_in_target post-install
prepare_first_boot
# ensure we do not have a lost+found directory in the root folder # ensure we do not have a lost+found directory in the root folder
# that could cause copy to fail (it will be created again later # that could cause copy to fail (it will be created again later
# when creating the file system, if it needs such directory) # when creating the file system, if it needs such directory)

View File

@ -1,12 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
set -o xtrace
touch /var/log/first-boot.d.log
chmod 0600 /var/log/first-boot.d.log
/usr/local/bin/dib-run-parts /etc/first-boot.d >> /var/log/first-boot.d.log 2>&1
rm -fr /etc/first-boot.d
# delete itself
rm $0

View File

@ -1,7 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
if [ -d /etc/first-boot.d ]; then
install -m 0755 -o root -g root $(dirname $0)/../dib-first-boot /usr/sbin/
fi

View File

@ -1,34 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
if [ -d /etc/first-boot.d ]; then
rc_local=/etc/rc.d/rc.local
FILE_EXISTED=
if [ -f $rc_local ]; then
FILE_EXISTED=1
mv $rc_local $rc_local.REAL
fi
dd of=$rc_local <<EOF
#!/bin/bash
set -e
set -o xtrace
dib-first-boot
EOF
if [ $FILE_EXISTED ]; then
echo "mv $rc_local.REAL $rc_local" >> $rc_local
else
echo "rm \$0" >> $rc_local
fi
echo "exit 0" >> $rc_local
chmod 755 $rc_local
# Enable the service
systemctl enable rc-local.service
fi

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -eu
set -o pipefail
if [ -d /etc/first-boot.d ]; then
rc_local=/etc/rc.local
mv $rc_local $rc_local.REAL
dd of=$rc_local <<EOF
#!/bin/bash
set -e
set -o xtrace
dib-first-boot
mv $rc_local.REAL $rc_local
exit 0
EOF
chmod 755 $rc_local
fi

View File

@ -60,43 +60,11 @@ function save_image () {
finish_image $1 finish_image $1
} }
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 ${ELEMENTS_PATH//:/ } ; do for dir in ${ELEMENTS_PATH//:/ } ; do
element_pre_check $dir/$_ELEMENT || continue [ -d $dir/$_ELEMENT ] || continue
cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ; cp -t $TMP_HOOKS_PATH -a $dir/$_ELEMENT/* ;
break break
done done

View File

@ -81,14 +81,6 @@ function run_d_in_target () {
fi fi
} }
function prepare_first_boot () {
check_break before-first-boot run_in_target bash
if [ -d ${TMP_HOOKS_PATH}/first-boot.d ] ; then
sudo cp -t $TMP_MOUNT_PATH/etc/ -a $TMP_HOOKS_PATH/first-boot.d
fi
check_break after-first-boot run_in_target bash
}
function finalise_base () { function finalise_base () {
TARGET_ROOT=$TMP_MOUNT_PATH run_d cleanup TARGET_ROOT=$TMP_MOUNT_PATH run_d cleanup
# If the file has been set immutable, we probably want to keep it # If the file has been set immutable, we probably want to keep it