summaryrefslogtreecommitdiffstats
path: root/tools/basebuilder.py
blob: 7047697557a7396dc0426724654c77a6ab680681 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python

from sys import argv
from elementtree.ElementTree import Element, SubElement, tostring

if __name__ == '__main__':
    dir = argv[1]
    imagename = dir.split('/')[-1]
    e = Element("Image", name=imagename)
    for line in open("%s/base.ConfigFile"%(dir)).readlines():
        SubElement(e, "ConfigFile", name=line.strip())
    for line in open("%s/base.Package"%(dir)).readlines():
        SubElement(e, "Package", name=line.strip())
    for line in open("%s/base.Service"%(dir)).readlines():
        SubElement(e, "Service", name=line.strip().split()[0])

    print tostring(e)