diff options
author | Stephane Desneux <stephane.desneux@iot.bzh> | 2018-09-21 11:12:22 +0000 |
---|---|---|
committer | Stéphane Desneux <stephane.desneux@iot.bzh> | 2018-10-09 13:58:34 +0000 |
commit | 9d89e19d57fed5bee24454d2e9cb28046facf3ec (patch) | |
tree | ac77953f1433ed372e8fa7383e1dc5e3e6dc12e8 /scripts/.aglsetup_genconfig.bash | |
parent | 795e47d4cb5e20f721d997e70d90199069a04848 (diff) |
aglsetup: generate setup manifest file
This patch modifies aglsetup to output the execution context in a
"setup manifest" located in $builddir/aglsetup.manifest
This file can then be processed by another script (distro-manifest-generator.sh)
to generate a complete distro manifest at build time.
Bug-AGL: SPEC-720, SPEC-1741
Change-Id: I1f9bc8a6d8bc4c659e59ed0025f71ad9e1c86355
Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'scripts/.aglsetup_genconfig.bash')
-rwxr-xr-x | scripts/.aglsetup_genconfig.bash | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/.aglsetup_genconfig.bash b/scripts/.aglsetup_genconfig.bash index b0d24e518..1e6eb1ee8 100755 --- a/scripts/.aglsetup_genconfig.bash +++ b/scripts/.aglsetup_genconfig.bash @@ -455,6 +455,8 @@ EOF $BUILDDIR/conf/setup.* \ $BUILDDIR/conf/*.log +####### step 1: generate configuration file ####### + if [[ -f $BUILDDIR/conf/local.conf || -f $BUILDDIR/conf/bblayers.conf ]]; then info "Configuration files already exist:" for x in $BUILDDIR/conf/local.conf $BUILDDIR/conf/bblayers.conf; do @@ -466,6 +468,45 @@ else genconfig fi +####### step 2: generate aglsetup.manifest ####### + +SETUP_MANIFEST=aglsetup.manifest + +infon "Generating setup manifest: $BUILDDIR/$SETUP_MANIFEST ... " +for x in /etc/os-release /usr/lib/os-release; do + [[ -f $x ]] && . $x +done +FEATURES_md5=$(echo $FEATURES|md5sum -|awk '{print $1;}') +cat <<EOF >$BUILDDIR/$SETUP_MANIFEST +# ---------------------------------------------- +# This fragment has been generated by $SCRIPT at setup time + +# distro name +DIST_DISTRO_NAME="AGL" + +# target machine as passed to $SCRIPT +DIST_MACHINE="$MACHINE" + +# features as resolved by $SCRIPT +DIST_FEATURES="$FEATURES" +DIST_FEATURES_MD5="${FEATURES_md5}" + +# build host information deduced from os-release +DIST_BUILD_HOST="$(id -un)@$(hostname -f || hostname || hostname -s)" +DIST_BUILD_OS="${PRETTY_NAME:-${NAME} ${VERSION} [COMPUTED]}" + +# meta directory +DIST_METADIR="$METADIR" + +# timestamp +DIST_SETUP_TS="$(date -u +%Y%m%d_%H%M%S_%Z)" + +# ------------ end of $SCRIPT fragment -------- +EOF +info "OK" + +####### step 3: generate agl-init-build-env ####### + # always generate setup script in builddir: it can be sourced later manually without re-running the setup infon "Generating setup file: $BUILDDIR/agl-init-build-env ... " @@ -477,11 +518,19 @@ fi if [ -n "\$SSTATE_DIR" ]; then BB_ENV_EXTRAWHITE="\$BB_ENV_EXTRAWHITE SSTATE_DIR" fi + +# build manifest generator used in distro-build-manifest.bb +BB_ENV_EXTRAWHITE="\$BB_ENV_EXTRAWHITE DISTRO_SETUP_MANIFEST DISTRO_MANIFEST_GENERATOR" +export DISTRO_SETUP_MANIFEST=$(realpath -Ls $BUILDDIR)/$SETUP_MANIFEST +export DISTRO_MANIFEST_GENERATOR=$(dirname $(realpath $BASH_SOURCE))/distro-manifest-generator.sh + export BB_ENV_EXTRAWHITE unset TEMPLATECONF EOF info "OK" +####### step 4: generate output script ####### + # finally, generate output script if requested by caller if [[ -n "$SETUPSCRIPT" ]]; then debug "generating setupscript in $SETUPSCRIPT" |