diff options
author | Sebastian Dziallas <sebastian@when.com> | 2009-03-20 22:55:28 (GMT) |
---|---|---|
committer | Sebastian Dziallas <sebastian@when.com> | 2009-03-20 22:55:28 (GMT) |
commit | 5c0babf7276d4826b084777a922f8c8298c433c6 (patch) | |
tree | 8644997610d4ececf28cfb28365b1e378b303cb8 /build | |
parent | 4a8e2a0eb551ce40a495a9aa0acdd61d0fe62ba2 (diff) |
remove old ks files and move to new build script (soas-2)
Diffstat (limited to 'build')
-rwxr-xr-x | build | 82 |
1 files changed, 3 insertions, 79 deletions
@@ -1,80 +1,4 @@ -#!/usr/bin/python +#!/bin/bash -import logging -import os -import sys -from time import gmtime, strftime - -import imgcreate -import appcreate -import shutil -import tarfile - -base_dir = os.path.dirname(__file__) -images_dir = os.path.join(base_dir, 'images') -appliances_dir = os.path.join(base_dir, 'appliances') -cache_dir = os.path.join(base_dir, 'cache') -last_file = os.path.join(images_dir, 'last') - -def main(): - - if not os.path.exists(images_dir): - os.mkdir(images_dir) - - image_date = strftime("%Y%m%d%H%M", gmtime()) - image_name = 'Soas2-%s' % image_date - if os.path.exists(os.path.join(images_dir, image_name + '.iso')): - print 'Image %s exist already' % image_name - sys.exit(2) - - ks = imgcreate.read_kickstart(os.path.join(base_dir, 'soas.ks')) - creator = imgcreate.LiveImageCreator(ks, image_name, image_name) - - try: - creator.mount(cachedir=cache_dir) - creator.install() - creator.configure() - creator.unmount() - creator.package(destdir=images_dir) - except imgcreate.CreatorError, e: - logging.error("Error creating Live CD : %s" % e) - return 1 - finally: - creator.cleanup() - - if not os.path.exists(appliances_dir): - os.mkdir(appliances_dir) - - appliance_date = strftime("%Y%m%d", gmtime()) - appliance_name = 'soas2-%s' % appliance_date - if os.path.exists(os.path.join(appliances_dir, appliance_name + '.tar.gz')): - print 'Appliance %s exist already' % appliance_name - sys.exit(2) - - ks = imgcreate.read_kickstart(os.path.join(base_dir, 'appliance.ks')) - creator = appcreate.ApplianceImageCreator(ks, 'soas2-appliance', 'vmdk', 512, 1) - - try: - creator.mount(cachedir=cache_dir) - creator.install() - creator.configure() - creator.unmount() - creator.package(appliances_dir, "none", "") - except imgcreate.CreatorError, e: - logging.error("Unable to create appliance : %s" % e) - return 1 - finally: - creator.cleanup() - - os.chdir('./appliances') - - tar = tarfile.open('%s.tar.gz' % appliance_name, 'w:gz') - tar.add('soas2-appliance') - tar.close() - - shutil.rmtree('soas2-appliance') - - return 0 - -if __name__ == "__main__": - sys.exit(main()) +python live.py +python appliance.py |