Move generation of dib_[environment|args] to manifest element
dib_[environment|args] manifest files are currently generated by the base element and then moved by the manifest element. This creates too many corner cases -- if you don't include the base element (we are trying to empty it ATM) you don't get the env/args saved at all; if you include base but don't include the manifest element they're saved to /etc, but if you do have the manifest element they're moved to the manifest dir. Move generation of these into the manifest element directly and update the documentation to reflect this. In practice this doesn't change things, because the "manifests" element gets pulled in via deps for most builds. Change-Id: I3f23037058137d166b29f0b70fd1a02c22c07fc8 Signed-off-by: Andreas Florath <andreas@florath.net>
This commit is contained in:
parent
1f75aea634
commit
870374c8da
|
@ -323,10 +323,6 @@ then one branch of a git repository or to get source for a local cache. See
|
||||||
Debugging elements
|
Debugging elements
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
The build-time environment and command line arguments are captured by the
|
|
||||||
:doc:`../elements/base/README` element and written to ``/etc/dib_environment``
|
|
||||||
and ``/etc/dib_arguments`` inside the image.
|
|
||||||
|
|
||||||
Export ``break`` to drop to a shell during the image build. Break points can be
|
Export ``break`` to drop to a shell during the image build. Break points can be
|
||||||
set either before or after any of the hook points by exporting
|
set either before or after any of the hook points by exporting
|
||||||
"break=[before|after]-hook-name". Multiple break points can be specified as a
|
"break=[before|after]-hook-name". Multiple break points can be specified as a
|
||||||
|
@ -339,6 +335,12 @@ comma-delimited string. Some examples:
|
||||||
|
|
||||||
* ``break=after-error`` will break after an error during an in target hookpoint.
|
* ``break=after-error`` will break after an error during an in target hookpoint.
|
||||||
|
|
||||||
|
The :doc:`../elements/manifests/README` element will make a range of
|
||||||
|
manifest information generated by other elements available for
|
||||||
|
inspection inside and outside the built image. Environment and
|
||||||
|
command line arguments are captured as described in the documentation
|
||||||
|
and can be useful for debugging.
|
||||||
|
|
||||||
Images are built such that the Linux kernel is instructed not to switch into
|
Images are built such that the Linux kernel is instructed not to switch into
|
||||||
graphical consoles (i.e. it will not activate KMS). This maximises
|
graphical consoles (i.e. it will not activate KMS). This maximises
|
||||||
compatibility with remote console interception hardware, such as HP's iLO.
|
compatibility with remote console interception hardware, such as HP's iLO.
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Store the build-time environment and command line arguments
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
[ -n "$TMP_HOOKS_PATH" ] || die "Temp hook path not set"
|
|
||||||
|
|
||||||
echo "$DIB_ENV" > $TMP_HOOKS_PATH/dib_environment
|
|
||||||
echo "$DIB_ARGS" > $TMP_HOOKS_PATH/dib_arguments
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
# Store build-time environment and command line arguments
|
|
||||||
|
|
||||||
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
set -eu
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
if [ -e "/tmp/in_target.d/dib_environment" ]; then
|
|
||||||
cp /tmp/in_target.d/dib_environment /etc/
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -e "/tmp/in_target.d/dib_arguments" ]; then
|
|
||||||
cp /tmp/in_target.d/dib_arguments /etc/
|
|
||||||
fi
|
|
|
@ -1,13 +1,25 @@
|
||||||
=========
|
=========
|
||||||
manifests
|
manifests
|
||||||
=========
|
=========
|
||||||
Copy any manifests generated into the build area post-image creation
|
|
||||||
|
|
||||||
This element should be a dependency of any element that writes a manifest
|
An framework for saving manifest information generated during the
|
||||||
into the `DIB_MANIFEST_IMAGE_DIR`, which defaults to `/etc/dib-manifests`.
|
build for later inspection. Manifests are kept in the final image and
|
||||||
This is created in extra-data.d rather than pre-install.d to allow the
|
also copied to the build area post-image creation.
|
||||||
source-repositories element to make use of it
|
|
||||||
|
|
||||||
The manifests are copied to `DIB_MANIFEST_SAVE_DIR`, which defaults to
|
Elements that wish to save any form of manifest should depend on this
|
||||||
`${IMAGE_NAME}.d/`, resulting in the manifests being available as
|
element and can save their data to into the ``DIB_MANIFEST_IMAGE_DIR`` (
|
||||||
`${IMAGE_NAME}.d/dib-manifests` by default
|
which defaults to ``/etc/dib-manifests``). Note this is created in
|
||||||
|
``extra-data.d`` rather than ``pre-install.d`` to allow the
|
||||||
|
``source-repositories`` element to make use of it
|
||||||
|
|
||||||
|
The manifests are copied to ``DIB_MANIFEST_SAVE_DIR``, which defaults
|
||||||
|
to ``${IMAGE_NAME}.d/``, resulting in the manifests being available as
|
||||||
|
``${IMAGE_NAME}.d/dib-manifests`` by default after the build.
|
||||||
|
|
||||||
|
Extra status
|
||||||
|
------------
|
||||||
|
|
||||||
|
This element will also add the files ``dib_environment`` and
|
||||||
|
``dib_arguments`` to the manifest recording the ``diskimage-builder``
|
||||||
|
specific environment (``DIB_*`` variables) and command-line arguments
|
||||||
|
respectively.
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
# Copyright 2014 Hewlett-Packard Development Company, L.P.
|
||||||
|
# Copyright 2017 Andreas Florath (andreas@florath.net)
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
@ -21,15 +22,15 @@ fi
|
||||||
set -eu
|
set -eu
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
if [ -d $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} ]; then
|
MANIFEST_IMAGE_PATH=${TMP_MOUNT_PATH}/${DIB_MANIFEST_IMAGE_DIR}
|
||||||
# Move the dib_environment and dib_arguments files into the manifests dir
|
|
||||||
if [ -e $TMP_MOUNT_PATH/etc/dib_arguments ]; then
|
# Double check: directory must be created in extra-data.d/20-manifest-dir
|
||||||
sudo mv $TMP_MOUNT_PATH/etc/dib_arguments $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}
|
[ -d ${MANIFEST_IMAGE_PATH} ] || {
|
||||||
fi
|
echo "Error: MANIFEST_IMAGE_PATH [${MANIFEST_IMAGE_PATH}] does not exist";
|
||||||
if [ -e $TMP_MOUNT_PATH/etc/dib_environment ]; then
|
exit 1; }
|
||||||
sudo mv $TMP_MOUNT_PATH/etc/dib_environment $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}
|
|
||||||
fi
|
echo "$DIB_ENV" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_environment # dib-lint: safe_sudo
|
||||||
mkdir -p ${DIB_MANIFEST_SAVE_DIR}
|
echo "$DIB_ARGS" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_arguments # dib-lint: safe_sudo
|
||||||
cp --no-preserve=ownership -rv $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} \
|
|
||||||
${DIB_MANIFEST_SAVE_DIR}
|
mkdir -p ${DIB_MANIFEST_SAVE_DIR}
|
||||||
fi
|
cp --no-preserve=ownership -rv ${MANIFEST_IMAGE_PATH} ${DIB_MANIFEST_SAVE_DIR}
|
||||||
|
|
Loading…
Reference in New Issue