d2d96619a2
Part of the project to remove cgcs references. Replace and shorten the path the needlessly long and complex "addons/wr-cgcs/layers/cgcs" path with just "stx". This update just fixes up paths found in scripts, comments and config files. Depends-On: https://review.openstack.org/579954 Depends-On: https://review.openstack.org/579957 Depends-On: https://review.openstack.org/580170 Depends-On: https://review.openstack.org/579984 Change-Id: I04d653f740f17d8a9b2732f26d36907f635d8950 Signed-off-by: Scott Little <scott.little@windriver.com>
97 lines
2.8 KiB
Bash
Executable File
97 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Build an IMG file capable of being booted in a virtual environment
|
|
# The default settings are vda device which the Cumulus environment expects
|
|
# and controller mode
|
|
|
|
usage () {
|
|
echo ""
|
|
echo "Usage: "
|
|
echo " build-img [--cpe] [--dest <filename>] [--part [1 | 2]]"
|
|
echo " --dest <tis.img>"
|
|
echo " --cpe Boots in CPE mode. Default is controller mode."
|
|
echo ""
|
|
}
|
|
|
|
DEST_ISO=bootimage_auto.iso
|
|
DEST_IMG=tis.img
|
|
AUTO_MODE=controller
|
|
HELP=0
|
|
PART=0
|
|
|
|
# read the options
|
|
TEMP=`getopt -o hp:d: --long help,cpe,part:,dest: -n 'test.sh' -- "$@"`
|
|
eval set -- "$TEMP"
|
|
|
|
# extract options and their arguments into variables.
|
|
while true ; do
|
|
case "$1" in
|
|
-h|--help) HELP=1 ; shift ;;
|
|
--cpe) AUTO_MODE=cpe; shift ;;
|
|
-d | --dest) DEST_IMG="$2"; shift; shift ;;
|
|
-p | --part) PART="$2"; shift; shift ;;
|
|
--) shift ; break ;;
|
|
*) echo "Internal error!" ; exit 1 ;;
|
|
esac
|
|
done
|
|
|
|
if [ $HELP -eq 1 ]; then
|
|
usage
|
|
exit 0
|
|
fi
|
|
|
|
echo PART=$PART
|
|
|
|
# Step 1: Build an ISO that autoboots
|
|
|
|
# Cumulus default device is vda
|
|
if [ $PART -ne 2 ]; then
|
|
build-iso --file bootimage_auto.iso --auto $AUTO_MODE --device vda --cumulus
|
|
fi
|
|
|
|
# Step 2: Convert the ISO to IMG
|
|
if [ $PART -ne 1 ]; then
|
|
INSTALL_ISO_TO_DISK_IMAGE=$MY_REPO/stx/extras.ND/scripts/install_iso_to_disk_image.sh
|
|
|
|
if [ ! -e "/dev/loop-control" -o ! -e "/dev/kvm" ]; then
|
|
CMD="cd $MY_WORKSPACE/export; \
|
|
$INSTALL_ISO_TO_DISK_IMAGE bootimage_auto.iso $DEST_IMG"
|
|
|
|
if [ "$HOSTNAME" == "yow-cgts3-centos7" ]; then
|
|
echo "Attempting to run kvm_iso_to_img on yow-cgts3-lx"
|
|
ssh -o StrictHostKeyChecking=no yow-cgts3-lx "$CMD"
|
|
if [ $? -ne 0 ]; then
|
|
echo "Failed to run update-efiboot-image on yow-cgts3-lx"
|
|
fi
|
|
fi
|
|
|
|
if [ "$HOSTNAME" == "yow-cgts2-centos7" ]; then
|
|
echo "Attempting to run kvm_iso_to_img on yow-cgts2-lx"
|
|
ssh -o StrictHostKeyChecking=no yow-cgts2-lx "$CMD"
|
|
if [ $? -ne 0 ]; then
|
|
echo "Failed to run update-efiboot-image on yow-cgts2-lx"
|
|
fi
|
|
fi
|
|
|
|
if [ ! -f "$MY_WORKSPACE/export/$DEST_IMG" ]; then
|
|
printf "\n"
|
|
printf "****************************************************************** \n"
|
|
printf "No kvm and/or loop device on this machine. To complete the build \n"
|
|
printf "please copy '$MY_WORKSPACE/export/bootimage_auto.iso' to a machine \n"
|
|
printf "that supports kvm and loop devices and run ... \n"
|
|
printf " $INSTALL_ISO_TO_DISK_IMAGE bootimage_auto.iso $DEST_IMG\n"
|
|
printf "****************************************************************** \n"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ ! -f "$MY_WORKSPACE/export/$DEST_IMG" ]; then
|
|
(
|
|
cd $MY_WORKSPACE/export
|
|
$INSTALL_ISO_TO_DISK_IMAGE bootimage_auto.iso $DEST_IMG
|
|
exit $?
|
|
)
|
|
fi
|
|
fi
|
|
|