Support building ACIs
App containers are a format used by rocket and are specified at the following url: https://github.com/appc/spec/ Change-Id: I8ac24f0194c4bf53dffd6c47e0587bc413101698
This commit is contained in:
parent
d748aa17d2
commit
eb6a260a5a
@ -45,9 +45,10 @@ function show_options () {
|
|||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)"
|
echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)"
|
||||||
echo " -o imagename -- set the imagename of the output image file(default image)"
|
echo " -o imagename -- set the imagename of the output image file(default image)"
|
||||||
echo " -t qcow2,tar,vhd,docker,raw -- set the image types of the output image files (default qcow2)"
|
echo " -t qcow2,tar,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)"
|
||||||
echo " File types should be comma separated. VHD outputting requires the vhd-util"
|
echo " File types should be comma separated. VHD outputting requires the vhd-util"
|
||||||
echo " executable be in your PATH."
|
echo " executable be in your PATH. ACI outputting requires the ACI_MANIFEST "
|
||||||
|
echo " environment variable be a path to a manifest file."
|
||||||
echo " -x -- turn on tracing"
|
echo " -x -- turn on tracing"
|
||||||
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
||||||
echo " -c -- clear environment before starting work"
|
echo " -c -- clear environment before starting work"
|
||||||
@ -103,6 +104,7 @@ COMPRESS_IMAGE="true"
|
|||||||
export DIB_ROOT_LABEL=""
|
export DIB_ROOT_LABEL=""
|
||||||
DIB_DEFAULT_INSTALLTYPE=${DIB_DEFAULT_INSTALLTYPE:-"source"}
|
DIB_DEFAULT_INSTALLTYPE=${DIB_DEFAULT_INSTALLTYPE:-"source"}
|
||||||
MKFS_OPTS=""
|
MKFS_OPTS=""
|
||||||
|
ACI_MANIFEST=${ACI_MANIFEST:-}
|
||||||
DOCKER_TARGET=""
|
DOCKER_TARGET=""
|
||||||
TEMP=`getopt -o a:ho:t:xucnp: -l no-tmpfs,offline,help,min-tmpfs:,image-size:,image-cache:,max-online-resize:,mkfs-options:,qemu-img-options:,ramdisk-element:,root-label:,install-type:,docker-target: -n $SCRIPTNAME -- "$@"`
|
TEMP=`getopt -o a:ho:t:xucnp: -l no-tmpfs,offline,help,min-tmpfs:,image-size:,image-cache:,max-online-resize:,mkfs-options:,qemu-img-options:,ramdisk-element:,root-label:,install-type:,docker-target: -n $SCRIPTNAME -- "$@"`
|
||||||
if [ $? -ne 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
if [ $? -ne 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||||
@ -279,10 +281,23 @@ run_d_in_target finalise
|
|||||||
finalise_base
|
finalise_base
|
||||||
|
|
||||||
for X in ${!IMAGE_TYPES[@]} ; do
|
for X in ${!IMAGE_TYPES[@]} ; do
|
||||||
if [ "${IMAGE_TYPES[$X]}" == "tar" ]; then
|
if [[ " tar aci " =~ "${IMAGE_TYPES[$X]}" ]]; then
|
||||||
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.tar --exclude ./sys \
|
if [ "${IMAGE_TYPES[$X]}" = "aci" ]; then
|
||||||
--exclude ./proc --xattrs --xattrs-include=\* .
|
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.aci --exclude ./sys \
|
||||||
sudo chown $USER: $IMAGE_NAME.tar
|
--exclude ./proc --xattrs --xattrs-include=\* \
|
||||||
|
--transform 's,^.,rootfs,S' .
|
||||||
|
if [ -n "$ACI_MANIFEST" ]; then
|
||||||
|
cp $ACI_MANIFEST ${TMP_BUILD_DIR}/manifest
|
||||||
|
sudo tar -C ${TMP_BUILD_DIR} --append -f $IMAGE_NAME.aci manifest
|
||||||
|
else
|
||||||
|
echo "No ACI_MANIFEST specified. An ACI_MANIFEST must be specified for"
|
||||||
|
echo " this image to be usable."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf $IMAGE_NAME.tar --exclude ./sys \
|
||||||
|
--exclude ./proc --xattrs --xattrs-include=\* .
|
||||||
|
fi
|
||||||
|
sudo chown $USER: $IMAGE_NAME.${IMAGE_TYPES[$X]}
|
||||||
unset IMAGE_TYPES[$X]
|
unset IMAGE_TYPES[$X]
|
||||||
elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then
|
elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then
|
||||||
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \
|
sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \
|
||||||
|
@ -5,7 +5,7 @@ set -o pipefail
|
|||||||
|
|
||||||
source $(dirname $0)/test_functions.bash
|
source $(dirname $0)/test_functions.bash
|
||||||
|
|
||||||
test_formats="tar raw qcow2 docker"
|
test_formats="tar raw qcow2 docker aci"
|
||||||
for binary in qemu-img docker ; do
|
for binary in qemu-img docker ; do
|
||||||
if [ -z "$(which $binary)" ]; then
|
if [ -z "$(which $binary)" ]; then
|
||||||
echo "Warning: No $binary binary found, cowardly refusing to run tests."
|
echo "Warning: No $binary binary found, cowardly refusing to run tests."
|
||||||
|
Loading…
Reference in New Issue
Block a user