Merge "Move generation of dib_[environment|args] to manifest element"
This commit is contained in:
commit
740c0a85df
@ -323,10 +323,6 @@ then one branch of a git repository or to get source for a local cache. See
|
||||
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
|
||||
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
|
||||
@ -339,6 +335,12 @@ comma-delimited string. Some examples:
|
||||
|
||||
* ``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
|
||||
graphical consoles (i.e. it will not activate KMS). This maximises
|
||||
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
|
||||
=========
|
||||
Copy any manifests generated into the build area post-image creation
|
||||
|
||||
This element should be a dependency of any element that writes a manifest
|
||||
into the `DIB_MANIFEST_IMAGE_DIR`, which defaults to `/etc/dib-manifests`.
|
||||
This is created in extra-data.d rather than pre-install.d to allow the
|
||||
source-repositories element to make use of it
|
||||
An framework for saving manifest information generated during the
|
||||
build for later inspection. Manifests are kept in the final image and
|
||||
also copied to the build area post-image creation.
|
||||
|
||||
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
|
||||
Elements that wish to save any form of manifest should depend on this
|
||||
element and can save their data to into the ``DIB_MANIFEST_IMAGE_DIR`` (
|
||||
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
|
||||
#
|
||||
# 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
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
@ -21,15 +22,15 @@ fi
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if [ -d $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} ]; then
|
||||
# Move the dib_environment and dib_arguments files into the manifests dir
|
||||
if [ -e $TMP_MOUNT_PATH/etc/dib_arguments ]; then
|
||||
sudo mv $TMP_MOUNT_PATH/etc/dib_arguments $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}
|
||||
fi
|
||||
if [ -e $TMP_MOUNT_PATH/etc/dib_environment ]; then
|
||||
sudo mv $TMP_MOUNT_PATH/etc/dib_environment $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR}
|
||||
fi
|
||||
mkdir -p ${DIB_MANIFEST_SAVE_DIR}
|
||||
cp --no-preserve=ownership -rv $TMP_MOUNT_PATH/${DIB_MANIFEST_IMAGE_DIR} \
|
||||
${DIB_MANIFEST_SAVE_DIR}
|
||||
fi
|
||||
MANIFEST_IMAGE_PATH=${TMP_MOUNT_PATH}/${DIB_MANIFEST_IMAGE_DIR}
|
||||
|
||||
# Double check: directory must be created in extra-data.d/20-manifest-dir
|
||||
[ -d ${MANIFEST_IMAGE_PATH} ] || {
|
||||
echo "Error: MANIFEST_IMAGE_PATH [${MANIFEST_IMAGE_PATH}] does not exist";
|
||||
exit 1; }
|
||||
|
||||
echo "$DIB_ENV" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_environment # dib-lint: safe_sudo
|
||||
echo "$DIB_ARGS" | sudo dd of=${MANIFEST_IMAGE_PATH}/dib_arguments # dib-lint: safe_sudo
|
||||
|
||||
mkdir -p ${DIB_MANIFEST_SAVE_DIR}
|
||||
cp --no-preserve=ownership -rv ${MANIFEST_IMAGE_PATH} ${DIB_MANIFEST_SAVE_DIR}
|
||||
|
Loading…
Reference in New Issue
Block a user