#!/bin/bash # # lib/dib # Install and build images with **diskimage-builder** # Dependencies: # # - functions # - DEST, DATA_DIR must be defined # stack.sh # --------- # - install_dib # Save trace setting XTRACE=$(set +o | grep xtrace) set +o xtrace # Defaults # -------- # set up default directories DIB_DIR=$DEST/diskimage-builder TIE_DIR=$DEST/tripleo-image-elements # NOTE: Setting DIB_APT_SOURCES assumes you will be building # Debian/Ubuntu based images. Leave unset for other flavors. DIB_APT_SOURCES=${DIB_APT_SOURCES:-""} DIB_BUILD_OFFLINE=$(trueorfalse False $DIB_BUILD_OFFLINE) DIB_IMAGE_CACHE=$DATA_DIR/diskimage-builder/image-create DIB_PIP_REPO=$DATA_DIR/diskimage-builder/pip-repo DIB_PIP_REPO_PORT=${DIB_PIP_REPO_PORT:-8899} OCC_DIR=$DEST/os-collect-config ORC_DIR=$DEST/os-refresh-config OAC_DIR=$DEST/os-apply-config # Include the apt-sources element in builds if we have an # alternative sources.list specified. if [ -n "$DIB_APT_SOURCES" ]; then if [ ! -e "$DIB_APT_SOURCES" ]; then die $LINENO "DIB_APT_SOURCES set but not found at $DIB_APT_SOURCES" fi EXTRA_ELEMENTS="apt-sources" fi # Functions # --------- # install_dib() - Collect source and prepare function install_dib { pip_install diskimage-builder git_clone $TIE_REPO $TIE_DIR $TIE_BRANCH git_clone $OCC_REPO $OCC_DIR $OCC_BRANCH git_clone $ORC_REPO $ORC_DIR $ORC_BRANCH git_clone $OAC_REPO $OAC_DIR $OAC_BRANCH mkdir -p $DIB_IMAGE_CACHE } # build_dib_pip_repo() - Builds a local pip repo from local projects function build_dib_pip_repo { local project_dirs=$1 local projpath proj package rm -rf $DIB_PIP_REPO mkdir -p $DIB_PIP_REPO echo "
" > $DIB_PIP_REPO/index.html for projpath in $project_dirs; do proj=$(basename $projpath) mkdir -p $DIB_PIP_REPO/$proj pushd $projpath rm -rf dist python setup.py sdist pushd dist package=$(ls *) mv $package $DIB_PIP_REPO/$proj/$package popd echo "$package" > $DIB_PIP_REPO/$proj/index.html echo "$proj