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
parentUpdating configurations for new-style partitioning (diff)
downloadgentoaster-1bae2a947fb5db183361f3cda1440d0192abec3a.tar.gz
gentoaster-1bae2a947fb5db183361f3cda1440d0192abec3a.tar.bz2
gentoaster-1bae2a947fb5db183361f3cda1440d0192abec3a.zip
Added compress flag to build tool
-rwxr-xr-xcreate_image.sh13
-rw-r--r--daemon.php2
-rw-r--r--status.php2
3 files changed, 13 insertions, 4 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"
diff --git a/daemon.php b/daemon.php
index 3665abc..af7143b 100644
--- a/daemon.php
+++ b/daemon.php
@@ -45,7 +45,7 @@
if(is_writable($build_path)) {
chdir($build_path);
file_put_contents("config.ini", $configuration_string);
- $tool_args = "--config config.ini";
+ $tool_args = "--config config.ini --compress";
$process_handle = popen($gentoaster_path."/".$tool_name." ".$tool_args." 2>&1", "r");
$nonstatus_output = "";
diff --git a/status.php b/status.php
index f5b5da0..e5624dd 100644
--- a/status.php
+++ b/status.php
@@ -20,7 +20,7 @@
} else {
$result = mysql_query("SELECT returncode, result FROM builds WHERE id = '".mysql_real_escape_string($argv[1])."'");
$jobres = mysql_fetch_array($result);
- if($jobres[0] != NULL) {
+ if($jobres[0] !== NULL) {
echo "Job returned with code ".$jobres[0].": ".$jobres[1]."\n";
} else {
echo "Job failed\n";