"Fossies" - the Fresh Open Source Software Archive

Member "octavia-8.0.0/diskimage-create/diskimage-create.sh" (14 Apr 2021, 18361 Bytes) of package /linux/misc/openstack/octavia-8.0.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "diskimage-create.sh": 7.1.1_vs_8.0.0.

    1 #!/bin/bash
    2 #
    3 # Copyright 2014 Hewlett-Packard Development Company, L.P.
    4 #
    5 # Licensed under the Apache License, Version 2.0 (the "License"); you may
    6 # not use this file except in compliance with the License. You may obtain
    7 # a copy of the License at
    8 #
    9 #   http://www.apache.org/licenses/LICENSE-2.0
   10 #
   11 # Unless required by applicable law or agreed to in writing, software
   12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   14 # License for the specific language governing permissions and limitations
   15 # under the License.
   16 #
   17 
   18 set -e
   19 
   20 usage() {
   21     echo
   22     echo "Usage: $(basename "$0")"
   23     echo "            [-a i386 | **amd64** | armhf | aarch64 | ppc64le]"
   24     echo "            [-b **haproxy** ]"
   25     echo "            [-c **~/.cache/image-create** | <cache directory> ]"
   26     echo "            [-d **focal**/**8** | <other release id> ]"
   27     echo "            [-e]"
   28     echo "            [-f]"
   29     echo "            [-g **repository branch** | stable/train | stable/stein | ... ]"
   30     echo "            [-h]"
   31     echo "            [-i **ubuntu-minimal** | fedora | centos-minimal | rhel ]"
   32     echo "            [-k <kernel package name> ]"
   33     echo "            [-l <log file> ]"
   34     echo "            [-n]"
   35     echo "            [-o **amphora-x64-haproxy** | <filename> ]"
   36     echo "            [-p]"
   37     echo "            [-r <root password> ]"
   38     echo "            [-s **2** | <size in GB> ]"
   39     echo "            [-t **qcow2** | tar | vhd | raw ]"
   40     echo "            [-v]"
   41     echo "            [-w <working directory> ]"
   42     echo "            [-x]"
   43     echo
   44     echo "        '-a' is the architecture type for the image (default: amd64)"
   45     echo "        '-b' is the backend type (default: haproxy)"
   46     echo "        '-c' is the path to the cache directory (default: ~/.cache/image-create)"
   47     echo "        '-d' distribution release id (default on ubuntu: focal)"
   48     echo "        '-e' enable complete mandatory access control systems when available (default: permissive)"
   49     echo "        '-f' disable tmpfs for build"
   50     echo "        '-g' build the image for a specific OpenStack Git branch (default: current repository branch)"
   51     echo "        '-h' display this help message"
   52     echo "        '-i' is the base OS (default: ubuntu-minimal)"
   53     echo "        '-k' is the kernel meta package name, currently only for ubuntu-minimal base OS (default: linux-image-virtual)"
   54     echo "        '-l' is output logfile (default: none)"
   55     echo "        '-n' disable sshd (default: enabled)"
   56     echo "        '-o' is the output image file name"
   57     echo "        '-p' install amphora-agent from distribution packages (default: disabled)"
   58     echo "        '-r' enable the root account in the generated image (default: disabled)"
   59     echo "        '-s' is the image size to produce in gigabytes (default: 2)"
   60     echo "        '-t' is the image type (default: qcow2)"
   61     echo "        '-v' display the script version"
   62     echo "        '-w' working directory for image building (default: .)"
   63     echo "        '-x' enable tracing for diskimage-builder"
   64     echo
   65     exit 1
   66 }
   67 
   68 version() {
   69     echo "Amphora disk image creation script version:"\
   70         "$(cat "${OCTAVIA_REPO_PATH}/diskimage-create/version.txt")"
   71     exit 1
   72 }
   73 
   74 find_system_elements() {
   75     # List of possible system installation directories
   76     local system_prefixes="/usr/share /usr/local/share"
   77     for prefix in $system_prefixes; do
   78         if [ -d "$prefix/$1" ]; then
   79             echo "$prefix/$1"
   80             return
   81         fi
   82     done
   83 }
   84 
   85 # Figure out where our directory is located
   86 if [ -z "$OCTAVIA_REPO_PATH" ]; then
   87     AMP_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
   88     OCTAVIA_REPO_PATH=${OCTAVIA_REPO_PATH:-${AMP_DIR%/*}}
   89 fi
   90 dib_enable_tracing=
   91 
   92 AMP_LOGFILE=""
   93 
   94 while getopts "a:b:c:d:efg:hi:k:l:no:pt:r:s:vw:x" opt; do
   95     case $opt in
   96         a)
   97             AMP_ARCH=$OPTARG
   98             if [ "$AMP_ARCH" != "i386" ] && \
   99                 [ "$AMP_ARCH" != "amd64" ] && \
  100                 [ "$AMP_ARCH" != "ppc64le" ] && \
  101                 [ "$AMP_ARCH" != "aarch64" ] && \
  102                 [ "$AMP_ARCH" != "armhf" ]; then
  103                 echo "Error: Unsupported architecture $AMP_ARCH specified"
  104                 exit 3
  105             fi
  106         ;;
  107         b)
  108             if [ "$OPTARG" == "haproxy" ]; then
  109                 AMP_BACKEND=$OPTARG-octavia
  110             else
  111                 echo "Error: Unsupported backend type $AMP_BACKEND specified"
  112                 exit 3
  113             fi
  114         ;;
  115         c)
  116             AMP_CACHEDIR=$OPTARG
  117         ;;
  118         d)
  119             AMP_DIB_RELEASE=$OPTARG
  120         ;;
  121         e)
  122             AMP_ENABLE_FULL_MAC_SECURITY=1
  123         ;;
  124         f)
  125             AMP_DISABLE_TMP_FS='--no-tmpfs'
  126         ;;
  127         g)
  128             if [ -z "$DIB_REPOREF_amphora_agent" ]; then
  129                 echo "Building image with amphora agent from $OPTARG."
  130                 export DIB_REPOREF_amphora_agent=$OPTARG
  131             else
  132                 echo "Environment variable DIB_REPOREF_amphora_agent is set. Building the image with amphora agent $DIB_REPOREF_amphora_agent."
  133             fi
  134             if [ -z "$DIB_REPOLOCATION_upper_constraints" ]; then
  135                 echo "Using upper constraints from https://opendev.org/openstack/requirements/raw/branch/$OPTARG/upper-constraints.txt."
  136                 export DIB_REPOLOCATION_upper_constraints="https://opendev.org/openstack/requirements/raw/branch/$OPTARG/upper-constraints.txt"
  137             else
  138                 echo "Environment variable DIB_REPOLOCATION_upper_constraints is set. Building the image with upper-constraints.txt from $DIB_REPOLOCATION_upper_constraints."
  139             fi
  140         ;;
  141         h)
  142             usage
  143         ;;
  144         i)
  145             AMP_BASEOS=$OPTARG
  146             if [ "$AMP_BASEOS" != "ubuntu" ] && \
  147                 [ "$AMP_BASEOS" != "ubuntu-minimal" ] && \
  148                 [ "$AMP_BASEOS" != "fedora" ] && \
  149                 [ "$AMP_BASEOS" != "centos" ] && \
  150                 [ "$AMP_BASEOS" != "centos-minimal" ] && \
  151                 [ "$AMP_BASEOS" != "rhel" ]; then
  152                 echo "Error: Unsupported base OS $AMP_BASEOS specified"
  153                 exit 3
  154             fi
  155             if [ "$AMP_BASEOS" == "ubuntu" ]; then
  156                 AMP_BASEOS="ubuntu-minimal"
  157             fi
  158             if [ "$AMP_BASEOS" == "centos" ]; then
  159                 AMP_BASEOS="centos-minimal"
  160             fi
  161         ;;
  162         k)
  163             AMP_KERNEL=$OPTARG
  164         ;;
  165         l)
  166             AMP_LOGFILE="--logfile=$OPTARG"
  167         ;;
  168         n)
  169             AMP_DISABLE_SSHD=1
  170         ;;
  171         o)
  172             AMP_OUTPUTFILENAME=$(readlink -f "$OPTARG")
  173             amp_dir=$(dirname "$AMP_OUTPUTFILENAME")
  174             if [ ! -d "$amp_dir" ]; then
  175                 echo "Error: Directory $amp_dir does not exist"
  176                 exit 3
  177             fi
  178         ;;
  179         p)
  180             AMP_PACKAGE_INSTALL=1
  181         ;;
  182         r)
  183             AMP_ROOTPW=$OPTARG
  184         ;;
  185         s)
  186             AMP_IMAGESIZE=$OPTARG
  187             if ! [[ $AMP_IMAGESIZE =~ ^[0-9]+$ ]]; then
  188                 echo "Error: Invalid image size $AMP_IMAGESIZE specified"
  189                 exit 3
  190             fi
  191         ;;
  192         t)
  193             AMP_IMAGETYPE=$OPTARG
  194             if [ "$AMP_IMAGETYPE" != "qcow2" ] && \
  195                 [ "$AMP_IMAGETYPE" != "tar" ] && \
  196                 [ "$AMP_IMAGETYPE" != "vhd" ] && \
  197                 [ "$AMP_IMAGETYPE" != "raw" ]; then
  198                 echo "Error: Unsupported image type $AMP_IMAGETYPE specified"
  199                 exit 3
  200             fi
  201         ;;
  202         v)
  203             version
  204         ;;
  205         w)
  206             AMP_WORKING_DIR=$OPTARG
  207         ;;
  208         x)  dib_enable_tracing=1
  209         ;;
  210         *)
  211             usage
  212         ;;
  213     esac
  214 done
  215 
  216 shift $((OPTIND-1))
  217 if [ "$1" ]; then
  218     usage
  219 fi
  220 
  221 # Set the Octavia Amphora defaults if they aren't already set
  222 AMP_ARCH=${AMP_ARCH:-"amd64"}
  223 
  224 AMP_BACKEND=${AMP_BACKEND:-"haproxy-octavia"}
  225 
  226 AMP_CACHEDIR=${AMP_CACHEDIR:-"$HOME/.cache/image-create"}
  227 # Make sure we have an absolute path for the cache location
  228 mkdir -p "$AMP_CACHEDIR"
  229 AMP_CACHEDIR="$( cd "$AMP_CACHEDIR" && pwd )"
  230 
  231 AMP_BASEOS=${AMP_BASEOS:-"ubuntu-minimal"}
  232 
  233 if [ "$AMP_BASEOS" = "ubuntu-minimal" ]; then
  234     export DIB_RELEASE=${AMP_DIB_RELEASE:-"focal"}
  235 elif [ "${AMP_BASEOS}" = "centos-minimal" ] || [ "${AMP_BASEOS}" = "rhel" ]; then
  236     export DIB_RELEASE=${AMP_DIB_RELEASE:-"8"}
  237 elif [ "${AMP_BASEOS}" = "fedora" ]; then
  238     export DIB_RELEASE=${AMP_DIB_RELEASE:-"28"}
  239 fi
  240 
  241 AMP_OUTPUTFILENAME=${AMP_OUTPUTFILENAME:-"$PWD/amphora-x64-haproxy"}
  242 
  243 AMP_IMAGETYPE=${AMP_IMAGETYPE:-"qcow2"}
  244 
  245 AMP_IMAGESIZE=${AMP_IMAGESIZE:-2}
  246 
  247 if [ "$AMP_BASEOS" = "ubuntu-minimal" ]; then
  248     export DIB_UBUNTU_KERNEL=${AMP_KERNEL:-"linux-image-virtual"}
  249 fi
  250 
  251 AMP_DISABLE_SSHD=${AMP_DISABLE_SSHD:-0}
  252 
  253 AMP_PACKAGE_INSTALL=${AMP_PACKAGE_INSTALL:-0}
  254 
  255 AMP_ENABLE_FULL_MAC_SECURITY=${AMP_ENABLE_FULL_MAC_SECURITY:-0}
  256 
  257 AMP_DISABLE_TMP_FS=${AMP_DISABLE_TMP_FS:-""}
  258 
  259 if [[ "$AMP_BASEOS" =~ ^(rhel|fedora)$ ]] && [[ "$AMP_IMAGESIZE" -lt 3 ]]; then
  260     echo "RHEL/Fedora based amphora requires an image size of at least 3GB"
  261     exit 1
  262 fi
  263 
  264 OCTAVIA_ELEMENTS_PATH=$OCTAVIA_REPO_PATH/elements
  265 
  266 if ! [ -d "$OCTAVIA_ELEMENTS_PATH" ]; then
  267     SYSTEM_OCTAVIA_ELEMENTS_PATH=$(find_system_elements octavia-image-elements)
  268     if [ -z "${SYSTEM_OCTAVIA_ELEMENTS_PATH}" ]; then
  269         echo "ERROR: Octavia elements directory not found at: $OCTAVIA_ELEMENTS_PATH Exiting."
  270         exit 1
  271     fi
  272     OCTAVIA_ELEMENTS_PATH=${SYSTEM_OCTAVIA_ELEMENTS_PATH}
  273 fi
  274 
  275 DIB_REPO_PATH=${DIB_REPO_PATH:-${OCTAVIA_REPO_PATH%/*}/diskimage-builder}
  276 
  277 if [ -d "$DIB_REPO_PATH" ]; then
  278     export PATH=$PATH:$DIB_REPO_PATH/bin
  279 else
  280     if ! disk-image-create --version > /dev/null 2>&1; then
  281         echo "ERROR: diskimage-builder repo directory not found at: $DIB_REPO_PATH or in path. Exiting."
  282         exit 1
  283     fi
  284 fi
  285 
  286 # For system-wide installs, DIB will automatically find the elements, so we only check local path
  287 if [ "$DIB_LOCAL_ELEMENTS_PATH" ]; then
  288     export ELEMENTS_PATH=$OCTAVIA_ELEMENTS_PATH:$DIB_LOCAL_ELEMENTS_PATH
  289 else
  290     export ELEMENTS_PATH=$OCTAVIA_ELEMENTS_PATH
  291 fi
  292 
  293 # Make sure we have a value set for DIB_OCTAVIA_AMP_USE_NFTABLES
  294 export DIB_OCTAVIA_AMP_USE_NFTABLES=${DIB_OCTAVIA_AMP_USE_NFTABLES:-False}
  295 
  296 export CLOUD_INIT_DATASOURCES=${CLOUD_INIT_DATASOURCES:-"ConfigDrive"}
  297 
  298 # Additional RHEL environment checks
  299 if [ "${AMP_BASEOS}" = "rhel" ]; then
  300     if [ -z "${DIB_LOCAL_IMAGE}" ]; then
  301         echo "DIB_LOCAL_IMAGE variable must be set and point to a RHEL base cloud image. Exiting."
  302         echo "For more information, see the README file in ${DIB_ELEMENTS_PATH}/elements/rhel"
  303         exit 1
  304     fi
  305 fi
  306 
  307 # Find out what platform we are on
  308 if [ -e /etc/os-release ]; then
  309     platform=$(grep '^NAME=' /etc/os-release | sed -e 's/\(NAME="\)\(.*\)\("\)/\2/g')
  310 else
  311     platform=$(head -1 /etc/system-release | grep -e CentOS -e 'Red Hat Enterprise Linux' || :)
  312     if [ -z "$platform" ]; then
  313         echo -e "Unknown Host OS. Impossible to build images.\nAborting"
  314         exit 2
  315     fi
  316 fi
  317 
  318 if [[ "$AMP_ROOTPW" ]] && [[ "$platform" != 'Ubuntu' ]] && ! [[ "$platform" =~ "Debian" ]]; then
  319     if [ "$(getenforce)" == "Enforcing" ]; then
  320         echo "A root password cannot be enabled for images built on this platform while SELinux is enabled."
  321         exit 1
  322     fi
  323 fi
  324 
  325 if [ "$AMP_ROOTPW" ]; then
  326     echo "Warning: Using a root password in the image, NOT FOR PRODUCTION USAGE."
  327 fi
  328 
  329 # Make sure we have the required packages installed
  330 if [[ "$platform" = 'Ubuntu' || "$platform" =~ 'Debian' ]]; then
  331     PKG_LIST="qemu-utils git kpartx debootstrap"
  332     for pkg in $PKG_LIST; do
  333         if ! dpkg --get-selections 2> /dev/null | grep -q "^${pkg}[[:space:]]*install$" >/dev/null; then
  334             echo "Required package $pkg is not installed.  Exiting."
  335             echo "Binary dependencies on this platform are: ${PKG_LIST}"
  336             exit 1
  337         fi
  338     done
  339 
  340     if [[ "$platform" = 'Ubuntu' ]]; then
  341         # Also check if we can build the BASEOS on this Ubuntu version
  342         UBUNTU_VERSION=$(lsb_release -r | awk '{print $2}')
  343         if [[ "$AMP_BASEOS" != "ubuntu-minimal" ]] && \
  344             [[ 1 -eq "$(echo "$UBUNTU_VERSION < 16.04" | bc)" ]]; then
  345                 echo "Ubuntu minimum version 16.04 required to build $AMP_BASEOS."
  346                 echo "Earlier versions don't support the extended attributes required."
  347                 exit 1
  348         fi
  349     else
  350         # Check if we can build the BASEOS on this Debian version
  351         DEBIAN_VERSION=$(lsb_release -r | awk '{print $2}')
  352         # As minimal Ubuntu version is 14.04, for debian it is Debian 8 Jessie
  353         if [[ "$AMP_BASEOS" != "ubuntu-minimal" ]] && \
  354             [[ 1 -eq "$(echo "$DEBIAN_VERSION < 8" | bc)" ]]; then
  355                 echo "Debian minimum version 8 required to build $AMP_BASEOS."
  356                 echo "Earlier versions don't support the extended attributes required."
  357                 exit 1
  358         fi
  359     fi
  360 elif [[ $platform =~ "SUSE" ]]; then
  361     # OpenSUSE
  362     # use rpm -q to check for qemu-tools and git-core
  363     PKG_LIST="qemu-tools git-core"
  364     for pkg in $PKG_LIST; do
  365         if ! rpm -q "$pkg" &> /dev/null; then
  366             echo "Required package ${pkg/\*} is not installed.  Exiting."
  367             echo "Binary dependencies on this platform are: ${PKG_LIST}"
  368             exit 1
  369         fi
  370     done
  371 elif [[ $platform =~ "Gentoo" ]]; then
  372     # Gentoo
  373     # Check /var/db for dev-vcs/git and app-emulation/[qemu|xen-tools] sys-fs/multipath-tools
  374     PKG_LIST="dev-vcs/git app-emulation/qemu|xen-tools sys-fs/multipath-tools"
  375     for pkg in $PKG_LIST; do
  376         if grep -qs '|' <<< "$pkg"; then
  377             c=$(cut -d / -f 1 <<<"$pkg")
  378             for p in $(cut -d / -f 2 <<<"$pkg" | tr "|" " "); do
  379                 if [ -d /var/db/pkg/"$c"/"$p"-* ]; then
  380                     continue 2
  381                 fi
  382             done
  383             echo "Required package ${pkg/\*} is not installed.  Exiting."
  384             echo "Binary dependencies on this platform are: ${PKG_LIST}"
  385             exit 1
  386         elif [ ! -d /var/db/pkg/"$pkg"-* ]; then
  387             echo "Required package ${pkg/\*} is not installed.  Exiting."
  388             echo "Binary dependencies on this platform are: ${PKG_LIST}"
  389             exit 1
  390         fi
  391     done
  392 else
  393     # fedora/centos/rhel
  394     # Actual qemu-img name may be qemu-img, qemu-img-ev, qemu-img-rhev, ...
  395     # "dnf|yum install qemu-img" works for all, but search requires wildcard
  396     PKG_LIST="qemu-img* git"
  397     for pkg in $PKG_LIST; do
  398         if ! rpm -qa "$pkg" ; then
  399             echo "Required package ${pkg/\*} is not installed.  Exiting."
  400             echo "Binary dependencies on this platform are: ${PKG_LIST}"
  401             exit 1
  402         fi
  403     done
  404 fi
  405 
  406 if  [ "$AMP_WORKING_DIR" ]; then
  407     mkdir -p "$AMP_WORKING_DIR"
  408     TEMP=$(mktemp -d "$AMP_WORKING_DIR/diskimage-create.XXXXXX")
  409 else
  410     TEMP=$(mktemp -d diskimage-create.XXXXXX)
  411 fi
  412 pushd "$TEMP" > /dev/null
  413 
  414 # Setup the elements list
  415 
  416 AMP_element_sequence=${AMP_element_sequence:-"base vm"}
  417 if [ "${AMP_BASEOS}" = "rhel" ] && [ "${DIB_RELEASE}" = "8" ]; then
  418     export DIB_INSTALLTYPE_pip_and_virtualenv=package
  419 fi
  420 AMP_element_sequence="$AMP_element_sequence ${AMP_BASEOS}"
  421 
  422 if [ "$AMP_PACKAGE_INSTALL" -eq 1 ]; then
  423     export DIB_INSTALLTYPE_amphora_agent=package
  424 fi
  425 
  426 # Add our backend element (haproxy, etc.)
  427 AMP_element_sequence="$AMP_element_sequence $AMP_BACKEND"
  428 
  429 if [ "$AMP_ROOTPW" ]; then
  430     AMP_element_sequence="$AMP_element_sequence root-passwd"
  431     export DIB_PASSWORD=$AMP_ROOTPW
  432 fi
  433 
  434 # Add the Amphora Agent and Pyroute elements
  435 AMP_element_sequence="$AMP_element_sequence rebind-sshd"
  436 AMP_element_sequence="$AMP_element_sequence no-resolvconf"
  437 AMP_element_sequence="$AMP_element_sequence amphora-agent"
  438 AMP_element_sequence="$AMP_element_sequence octavia-lib"
  439 AMP_element_sequence="$AMP_element_sequence sos"
  440 AMP_element_sequence="$AMP_element_sequence cloud-init-datasources"
  441 AMP_element_sequence="$AMP_element_sequence remove-default-ints"
  442 
  443 if [ "$AMP_ENABLE_FULL_MAC_SECURITY" -ne 1 ]; then
  444     # SELinux systems
  445     if [ "${AMP_BASEOS}" = "centos-minimal" ] || [ "${AMP_BASEOS}" = "fedora" ] || [ "${AMP_BASEOS}" = "rhel" ]; then
  446         AMP_element_sequence="$AMP_element_sequence selinux-permissive"
  447     fi
  448 fi
  449 
  450 # Disable the dnf makecache timer
  451 if [ "${AMP_BASEOS}" = "centos-minimal" ] || [ "${AMP_BASEOS}" = "fedora" ] || [ "${AMP_BASEOS}" = "rhel" ]; then
  452     AMP_element_sequence="$AMP_element_sequence disable-makecache"
  453 fi
  454 
  455 if [ "${AMP_BASEOS}" = "centos-minimal" ]; then
  456     export DIB_YUM_MINIMAL_CREATE_INTERFACES=0
  457 fi
  458 
  459 # Add keepalived-octavia element
  460 AMP_element_sequence="$AMP_element_sequence keepalived-octavia"
  461 AMP_element_sequence="$AMP_element_sequence ipvsadmin"
  462 
  463 # Add pip-cache element
  464 AMP_element_sequence="$AMP_element_sequence pip-cache"
  465 
  466 # Add certificate ramfs element
  467 AMP_element_sequence="$AMP_element_sequence certs-ramfs"
  468 
  469 # Disable SSHD if requested
  470 if [ "$AMP_DISABLE_SSHD" -eq 1 ]; then
  471     AMP_element_sequence="$AMP_element_sequence remove-sshd"
  472 fi
  473 
  474 # Allow full elements override
  475 if [ "$DIB_ELEMENTS" ]; then
  476     AMP_element_sequence="$DIB_ELEMENTS"
  477 fi
  478 
  479 if [ "$DIB_LOCAL_ELEMENTS" ]; then
  480     AMP_element_sequence="$AMP_element_sequence $DIB_LOCAL_ELEMENTS"
  481 fi
  482 
  483 # Set Grub timeout to 0 (no timeout) for fast boot times
  484 export DIB_GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-0}
  485 
  486 # Build the image
  487 
  488 export DIB_CLOUD_INIT_DATASOURCES=$CLOUD_INIT_DATASOURCES
  489 
  490 dib_trace_arg=
  491 if [ -n "$dib_enable_tracing" ]; then
  492     dib_trace_arg="-x"
  493 fi
  494 
  495 if [ "$USE_PYTHON3" = "False" ]; then
  496     export DIB_PYTHON_VERSION=2
  497 fi
  498 
  499 disk-image-create "$AMP_LOGFILE" "$dib_trace_arg" -a "$AMP_ARCH" -o "$AMP_OUTPUTFILENAME" -t \
  500 "$AMP_IMAGETYPE" --image-size "$AMP_IMAGESIZE" --image-cache "$AMP_CACHEDIR" "$AMP_DISABLE_TMP_FS" \
  501 "$AMP_element_sequence"
  502 
  503 popd > /dev/null # out of $TEMP
  504 rm -rf "$TEMP"
  505 
  506 if [ -z "$DIB_REPOREF_amphora_agent" ]; then
  507     echo "Successfully built the amphora image using amphora-agent from the master branch."
  508 else
  509     echo "Successfully built the amphora using the $DIB_REPOREF_amphora_agent amphora-agent."
  510 fi
  511 echo "Amphora image size: `stat -c "%n %s" $AMP_OUTPUTFILENAME`"