Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/build
blob: aec1b9c0fe07f9514568a74c08969e4bba36f776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python

import logging
import os
import sys

import imgcreate

base_dir = os.path.dirname(__file__)
images_dir = os.path.join(base_dir, 'images')
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)

    try:
        last = open(last_file).read()
        version = int(last) + 1
    except IOError:
        version = 1

    ks = imgcreate.read_kickstart(os.path.join(base_dir, 'soas.ks'))
    creator = imgcreate.LiveImageCreator(ks, 'soas-1', 'Sugar')

    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()

    open(last_file, 'w').write(str(version))

    return 0

if __name__ == "__main__":
    sys.exit(main())