aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiam McLoughlin <hexxeh@hexxeh.net>2011-07-11 00:53:34 +0100
committerLiam McLoughlin <hexxeh@hexxeh.net>2011-07-11 00:53:34 +0100
commit1bae2a947fb5db183361f3cda1440d0192abec3a (patch)
treec171e681ea40c6641ff4d1bcf1792c0bd778b9ef /create_image.sh
parentUpdating configurations for new-style partitioning (diff)
downloadgentoaster-1bae2a947fb5db183361f3cda1440d0192abec3a.tar.gz
gentoaster-1bae2a947fb5db183361f3cda1440d0192abec3a.tar.bz2
gentoaster-1bae2a947fb5db183361f3cda1440d0192abec3a.zip
Added compress flag to build tool
Diffstat (limited to 'create_image.sh')
-rwxr-xr-xcreate_image.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/create_image.sh b/create_image.sh
index 0cc7f4f..94004a8 100755
--- a/create_image.sh
+++ b/create_image.sh
@@ -29,6 +29,7 @@ RUNNING_DIRECTORY=$(cd `dirname $0` && pwd)
DEFINE_string 'config' '' 'configuration to build from'
DEFINE_string 'proxy' '' 'HTTP proxy to use for emerges'
DEFINE_boolean 'cachedkernel' false 'use a cached kernel (shortens build time)'
+DEFINE_boolean 'compress' false 'compressed the finished image'
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
@@ -263,21 +264,29 @@ case "${OUTPUT_FORMAT}" in
;;
"vbox" )
echo "Converting image from RAW to VDI" &>> ${LOG_FILE}
- qemu-img convert -O vdi ${IMAGE_NAME} ${BUILD_ID}.vdi || handle_error "Error converting disk image to VDI format"
+ qemu-img convert -O vdi ${IMAGE_NAME} ${BUILD_ID}.vdi &>> ${LOG_FILE} || handle_error "Error converting disk image to VDI format"
rm -rf ${IMAGE_NAME}
IMAGE_OUT="${BUILD_ID}.vdi"
;;
"vmware" )
echo "Converting image from RAW to VMDK" &>> ${LOG_FILE}
- qemu-img convert -O vmdk ${IMAGE_NAME} ${BUILD_ID}.vmdk || handle_error "Error converting disk image to VMDK format"
+ qemu-img convert -O vmdk ${IMAGE_NAME} ${BUILD_ID}.vmdk &>> ${LOG_FILE} || handle_error "Error converting disk image to VMDK format"
rm -rf ${IMAGE_NAME}
IMAGE_OUT="${BUILD_ID}.vmdk"
;;
esac
+
mv ${IMAGE_OUT} ${IMAGES_OUTPUT_PATH}/${IMAGE_OUT} || handle_error "Error moving finished image"
mv ${LOG_FILE} ${IMAGES_OUTPUT_PATH}/${BUILD_ID}.log || handle_error "Error moving log file"
+LOG_FILE="${IMAGES_OUTPUT_PATH}/${BUILD_ID}.log"
rm -rf ${IMAGE_WORK_PATH} || handle_error "Error removing working directory"
+if [[ ${FLAGS_compress} -eq ${FLAGS_TRUE} ]]; then
+ cd ${IMAGES_OUTPUT_PATH}
+ tar czvf "${BUILD_ID}.tar.gz" "${IMAGE_OUT}" &>> ${LOG_FILE} || handle_error "Error compressing image"
+ IMAGE_OUT="${BUILD_ID}.tar.gz"
+fi
+
echo "Step 23: Image build completed!"
echo "Your image is here: ${IMAGES_OUTPUT_PATH}/${IMAGE_OUT}"
echo "Your log file is here: ${IMAGES_OUTPUT_PATH}/${BUILD_ID}.log"